[英]Cannot access ASP.NET Core application hosted in a Windows Service
I'm trying to create a ASP.NET core app which is hosted in a Windows Service, following the official documentation . 我正在尝试根据官方文档创建Windows服务中托管的ASP.NET核心应用程序。
The only difference I made is that I used Network Service account, and made Kestrel listen to port 10090, instead of the default 5000. 我所做的唯一区别是,我使用了网络服务帐户,并使Kestrel监听端口10090,而不是默认的5000。
After publish the binaries to the server(Windows Server 2012 R2), everything works fine via local access(on the server using http://localhost:10090/ ), but the web cannot be accessed on other PCs. 将二进制文件发布到服务器(Windows Server 2012 R2)之后,一切都可以通过本地访问(在使用http:// localhost:10090 /的服务器上)正常运行,但是无法在其他PC上访问Web。 Showing
显示
This site can’t be reached
server-1 took too long to respond.
This server also has some IIS hosted web application and they are working fine. 该服务器还具有一些IIS托管的Web应用程序,并且运行良好。
Does anybody knows the missing points I made? 有人知道我提出的遗漏吗? Thanks!
谢谢!
With help from my colleague I found that it is a programming issue. 在我同事的帮助下,我发现这是一个编程问题。
When creating the IWebHostBuilder
in Program.cs, I wrongly set the option of Kestrel (copy and paste from official documentation ): 在Program.cs中创建
IWebHostBuilder
时,我错误地设置了Kestrel的选项(从官方文档进行复制和粘贴):
options.Listen(IPAddress.Loopback, 10090);
While one of the correct option is IPAddress.Any
. 而正确的选项之一是
IPAddress.Any
。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.