Hosting ASP.NET in my application

Today I had a wild thought. I found that my users, like my web interfaces, are larger than my WinForms UIs ... but there is every reason to write a smart client application.

Can I write my app frontend in ASP.NET/MVC, host it inside my client exe, and access it locally using an IE control in my winforms app?

Is there a lightweight server that I can host in a process or fork? Has anyone tried this? Were the results flat?


source to share

4 answers



Yes, the short answer is: get the Cassini source and it will show you how to host your web server.

I used this method to host webservices (* .asmx). When an application is online, it can connect to the Internet and use a web service there. When disabled, it uses "localhost" to connect the local web service instance to it. Thus, you only need to write one level of data access.



I think the wild thought is an understatement;) I highly recommend that you consider if there is anything you are missing if there is no better solution, but here it is ...

There is such a lightweight server. It is also used by visual studio for developers. It was originally called Cassini which uses System.Web.Hosting (a low level API for creating an http server and hosting an process)



Late to the party check out the C # web server



All Articles