ASP.Net自托管应用程序

编程入门 行业动态 更新时间:2024-10-28 13:23:50
本文介绍了ASP.Net自托管应用程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

如何从控制台应用程序控制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自托管应用程序

本文发布于:2023-11-16 18:05:17,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1606589.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:应用程序   ASP   Net

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!