gpt4 book ai didi

c# - ASP.NET5 | MVC6项目托管使用80端口

转载 作者:太空宇宙 更新时间:2023-11-03 23:28:13 25 4
gpt4 key购买 nike

有一个 MVC 6 (beta 7) 项目。我通过 VisualStudio 2015 发布向导将其发布到本地文件夹(在 Windows Server 2012 上)。这是 hosting.ini 文件:

server=Microsoft.AspNet.Server.WebListener
server.urls=http://localhost:80

这是在 project.json 中启动服务器的命令:

"web": "Microsoft.AspNet.Hosting --config hosting.ini",

我通过执行由本地文件夹中的发布向导生成的 web.cmd 来启动服务器。

网站在本地机器上运行良好(http://localhost)。

好了,现在是最有趣的。我尝试从外部计算机打开它并查看

HTTP Error 404. The requested resource is not found.

响应头是:

Connection:close

Content-Length:315

Content-Type:text/html;

charset=us-ascii Server:Microsoft-HTTPAPI/2.0

好的,我发现 WAMP/Apache 托管存在类似问题,例如 thisthis .

我尝试执行以下操作:

  1. 禁用万维网发布服务
  2. 禁用 Web 部署代理服务
  3. 确保没有 SQL Server Reporting Services 和 Branch Cache Service
  4. 禁用 IIS
  5. 在防火墙中添加端口 80 的规则
  6. 通过 PID 杀死来自 tasklist/M httpapi.dll 命令的所有进程(之后没有从 netstat -ano 监听 80 端口 命令),然后启动应用程序。

但这并没有帮助。

注意:这是第 6 节后启动应用程序后 tasklist/M httpapi.dll 命令的结果:

enter image description here

这是一个 PID 为 1800 的进程:

enter image description here

什么以及为什么会阻塞 80 端口?

我该如何解决这个问题?

谢谢!

最佳答案

我认为问题出在您对站点的绑定(bind)。在你的配置中你说:

server.urls=http://localhost:80

这意味着只有当您的浏览器窗口中有 URL http://localhost 时,该站点才会响应您,但是对于外部 URL,您将使用 http://192.168 .100.100 例如。尝试更改 URL 以匹配它(显然使用您自己的 IP 地址或机器名称):

server.urls=http://192.168.100.100:80

我认为您还可以通过用分号或逗号分隔来指定多个 URL:

server.urls=http://localhost:80;http://server:80;http://192.168.100.100:80

关于c# - ASP.NET5 | MVC6项目托管使用80端口,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33127695/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com