我有一个完整工作的ASP.NET MVC应用程序(由5个程序集组成,.NET 4.5.1,ASP.NET MVC5.2.2),它在Visual Studio (使用IISExpress)中运行良好。
我现在希望有一个控制台应用程序,它接受MVC应用程序并托管它(自托管)。
我尝试使用Microsoft.Owin.Host.HttpListener
和Nancy.Owin
,但是虽然我有404个页面,但我的配置缺乏到我的MVC-app的映射。
我得到了
public class Startup
{
public void Configuration(IAppBuilder app)
{
app.UseNancy();
}
}
和
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();
}
}
但显然,在运行的MVC应用程序中缺少使用MyMvcApplication
的配置。如何做到这一点?或者如何进行自我托管?
我在网上找到的答案指的是更老的版本,我希望今天能有一个更简单的方法。
https://stackoverflow.com/questions/27226954
复制相似问题