如何从控制台应用程序控制ASP.Net 5应用程序?我发现的所有自托管应用程序示例均假定Web服务器的生存期与应用程序的生存期匹配.是否可以将带有 Startup.cs 文件和主程序集(控制台应用程序)的ASP.Net 5应用程序进行组装,从而允许使用此 Startup 类启动和停止Web应用程序我什么时候需要?例如,Node.js允许在代码中的任何位置启动新服务器,例如
How to control ASP.Net 5 application from console application? All examples of self-hosted application I've found assume that the lifetime of the webserver matches the lifetime of application. Is it possible to have assembly of ASP.Net 5 application with Startup.cs file and main assembly (console app) which allows to start and stop web application using this Startup class when I need? For example, Node.js allows to initiate new server at any place in code, like this
http.createServer(function (req, res) { /* processing request }).listen(80, '127.0.0.1');是否可以在ASP.Net 5中实现类似的功能?
Is it possible to implement anything like this in ASP.Net 5?
推荐答案在Program.Main中使用托管API时,您可以实现相同的目的.
When you use the hosting API in your Program.Main, you can achieve the same thing.
更新:这是RC1 API:
UPDATE: This is the RC1 API:
github/aspnet/Hosting/blob/1.0.0-rc1/src/Microsoft.AspNet.Hosting/Program.cs
RC1的发布与众不同
post RC1 is very different
更多推荐
ASP.Net自托管应用程序
发布评论