What's the best way to self-host an MVC 2 app in my Windows Service app?

I'm talking 3 projects: one MVC2 application, the second is Windows Service and dll that is used by the service. I can install and uninstall a service on the system, but I need MVC to be "on" when the service is on and "off" when not running.

Any other things like IIS are more appropriate, but let's say they are not available.

Sorry for my English. In other words, I need to host an MVC web app in my C # Windows Service.

+3


source to share


2 answers


ASP.NET MVC just introduced self hosting with MVC4 as it replaced WCF Web API. Before that, MVC was focused on human readable websites rather than web services, so it didn't make sense to have self-hosting now. Here is the article. If you are limited to MVC2, then I don't think it is possible.



+5


source


I don't think you can host MVC with Windows service. You are just making your life very difficult. If you want to bypass IIS, you will have to write your own web host.



0


source







All Articles