lundi 1 décembre 2014

Self-host of ASP.NET MVC application


Vote count:

0




I have a full-working ASP.NET MVC application (consisting of 5 assemblies, .NET 4.5.1, ASP.NET MVC 5.2.2) which runs fine in Visual Studio (which uses IISExpress).


I would now like to have a console application which takes the MVC application and hosts it (self hosting).


I tried with Microsoft.Owin.Host.HttpListener and Nancy.Owin but while I get 404 pages my configurations lacks the mapping to my MVC-app.


I got



public class Startup
{
public void Configuration(IAppBuilder app)
{
app.UseNancy();
}
}


and



static void Main(string[] args)
{
StartOptions so = new StartOptions("http://localhost:9000/");
using (WebApp.Start<Startup>(so))
{
Console.WriteLine("Press Enter to Exit");
Console.ReadLine();
}
}


But obviously the configuration to use MyMvcApplication from the running MVC application is missing. How to do that? Or how to selfhost it otherwise?


The answers I found on the web refer to older versions and I was hoping to have a more easy way today.



asked 40 secs ago

ZoolWay

1,364






Self-host of ASP.NET MVC application

Aucun commentaire:

Enregistrer un commentaire