开发者

How to run a leightweight ASP.NET MVC application that would be accessible only locally (not on IIS)?

开发者 https://www.devze.com 2023-01-19 17:44 出处:网络
We have a desktop client application and recent customer requests indicate that they would like to have some dynamic HTML content served and displayed by the application.

We have a desktop client application and recent customer requests indicate that they would like to have some dynamic HTML content served and displayed by the application.

We are considering hosting a simple ASP.NET application开发者_JS百科 in a local process, accessible only from the local machine (similar to the ASP.NET development web server used when debugging from Visual Studio).

How can we run an ASP.NET application locally without IIS? IIS is not an option because most client machines will not have it installed.

Is there a leightweight ASP.NET web server that could run locally similar to the development web server that VS is using?

I have found some information about "Cassini". Is this suitable for production use? Can it handle ASP.NET MVC? Are there any alternatives we should consider?


I have not used it myself, but you can try the mono XPS server.

It is a stand alone webserver.

The easiest way to start XSP is to run it from within the root directory of your application. It will serve requests on port 8080. Place additional assemblies in the bin directory.

Cassini is in fact also a good option - it is the development web server that comes with visual studio (so widely distributed, used and tested) and is also used by the open source ScrewTurnWiki. See wikipedia.


In regards to your "only locally" requirement - a web server will serve any request made to the right port. In order to limit accessibility, you should use a firewall that will block any external requests.


You might consider using WCF to host a service on the local machine that can serve the data without having to host a full blown web server.

If you do this, WCF allows you to expose the service with multiple endpoints and make it available through HTTP, TCP, or Namepipes. Namepipes would restrict traffic to only the local machine.


I have also tried IIS Express. It works great with ASP.NET MVC. Right now it is available only with Web Matrix, but installing web matrix is easy.


Coming back to this question three years later, ServiceStack.NET with self-hosted option seems like a good choice. While it is not ASP.NET MVC directly, it provides a good API and features are on par with ASP.NET MVC/WebAPI (or in some ways better).

0

精彩评论

暂无评论...
验证码 换一张
取 消