简体   繁体   English

无法访问Windows服务中托管的ASP.NET Core应用程序

[英]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.

相关问题 如果自定义配置设置在ASP.NET Core 2应用程序启动过程中不存在/无效(托管在Windows服务中),如何正常失败? - How to fail gracefully if custom configuration settings are not present/valid during ASP.NET Core 2 application startup (hosted in a Windows Service)? ASP.Net Core 2.1 应用程序在作为 Windows 服务运行时找不到 appsettings.json - ASP.Net Core 2.1 application cannot find appsettings.json when ran as a Windows service 无法访问ASP.NET Core后台服务中的已处置对象 - Cannot access a disposed object in ASP.NET Core background service ASP.NET Core 托管在 Windows 服务中 - 未提供静态文件(即 /wwwroot 的内容) - ASP.NET Core hosted in a Windows Service - static files not being served (i.e. contents of /wwwroot) 我无法访问我在 windows 服务器 2016 中的 iis 下托管的 asp.net 核心服务器 - I cannot reach my asp.net core server hosted under iis in windows server 2016 将ASP.NET Core托管为Windows服务 - Hosting ASP.NET Core as Windows service 防止并行执行扩展的 ASP.NET Core 托管服务 - Prevent parallel executions of scaled ASP.NET Core hosted service 在 ASP.NET 核心的托管服务中使用范围服务 - Using Scoped services within a hosted service in ASP.NET Core 无法访问会话 asp.net 核心 - Cannot access session asp.net core 是否需要服务用户帐户才能将 ASP.NET 核心应用程序部署为 Windows 服务? - Is it necessary to have a Service User Account to deploy an ASP.NET Core Application as a Windows Service?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM