Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

self hosting asp.net mvc

Is it possible to self host asp.net mvc inside another application ie. console, windows forms, service etc etc.

I'd like to build an app that offers a web interface to control it and I'd like to use asp.net mvc for the web part of it.

I did take a quick look at Nancy which looks like it would work, though its not asp.net mvc it did support razor although it doesn't have quite the same level of support for it as asp.net (eg. strongly typed views)

I did also find this question but it doesn't really go into much depth Possible to use ASPNET MVC2 without IIS?

like image 203
Daniel Powell Avatar asked Apr 30 '12 05:04

Daniel Powell


People also ask

Can ASP Net Web API ability to both self hosting and IIS?

ASP.NET Web API can be either be hosted in IIS or in a separate host process. The former approach is usually appropriate when the Web API is part of a web application and one or more web applications are going to consume it.

Can MVC core applications can host themselves?

Yes. In fact, all ASP.NET Core applications are self-hosted.

What is self hosting in .NET Core?

Self Host just means it uses the built-in Web Server, which is in contrast to classic ASP.NET Framework Web Apps which typically requires IIS or the built-in WebDev server to run.

Can ASP.NET Core Web API be self hosted?

In this article. This tutorial shows how to host a web API inside a console application. ASP.NET Web API does not require IIS. You can self-host a web API in your own host process.


2 Answers

You can use "IIS 7.0 Hostable Web Core" and host the web server as part of any user process, even a console application. The benefit is that it is very similar to full blown IIS (incl config etc) but the web server itself is running in your process.

Have a look at the following articles:

  1. Host your own Web Server in your application using IIS 7.0 Hostable Web Core
  2. Creating Hosted Web Core Applications
like image 97
bloudraak Avatar answered Oct 07 '22 05:10

bloudraak


Please have a look at http://cassinidev.codeplex.com/ It has many advantages for example

  • No need IIS 7 on client machine
  • Support MVC (I have tested myself)
  • Work well with Windows Form and Web Browser Control for packaging as Windows App
  • Cross Win OS platform ( Windows XP, Vista, 7) I have test XP with .NET 4 installed

Hope this helps.

like image 24
embarus Avatar answered Oct 07 '22 04:10

embarus