我有一个应用程序,在.Net下工作很好。我需要能够从自托管控制台应用程序运行相同的应用程序。我该怎么做?我应该使用OWIN吗?代码应该是什么样子的?
发布于 2014-08-26 07:25:26
更新
现在ASP.NET核心已经出来了,有几种方法可以自托管web应用程序。一种选择是使用诸如Nowin之类的OWIN based web server。
var host = new WebHostBuilder()
.UseNowin()
.UseContentRoot(Directory.GetCurrentDirectory())
.UseStartup<Startup>()
.Build();
或者,Kestrel也是hosting ASP.NET Core应用程序的流行选择。
var host = new WebHostBuilder()
.UseUrls("http://*:1000") // default URL
.UseKestrel()
.Build();
原始答案
您不能自行托管MVCMVC5( ASP.NET的当前版本)。不过,你现在可以使用NancyFx,也可以看看支持OWIN的ASP.NET vNext。
请注意,如果您需要制作单页面应用程序(但这不是服务器端的MVC),您现在也可以在OWIN中使用WebApi。
https://stackoverflow.com/questions/25478451
复制相似问题