[英]In Aspnet.Core, can we change port number?
I work on as.net core web api project.我在 as.net core web api 项目上工作。 I will publish this project to remote server.我会将这个项目发布到远程服务器。 When Kestrel is running, default port is 5000 or anythink like this.当 Kestrel 运行时,默认端口是 5000 或任何类似的端口。
I want to change this port to 80 or 8080. Can I do that?我想将此端口更改为 80 或 8080。我可以这样做吗?
When I try to change from launchSettings, I get this error:当我尝试从 launchSettings 进行更改时,出现此错误:
System.IO.IOException: 'Failed to bind to address http://localhost:80.'
Your problem may be because you already have another web server running on your system (eg IIS) that is already binding to port 80.您的问题可能是因为您的系统(例如 IIS)上已经运行了另一个 web 服务器,该服务器已经绑定到端口 80。
You can check with this powershell command:您可以使用此 powershell 命令进行检查:
Get-Process -Id (Get-NetTCPConnection -LocalPort 80).OwningProcess
This command will show you what process is listening on port 80. If nothing is listening, it will return an error.此命令将显示哪个进程正在侦听端口 80。如果没有任何进程在侦听,它将返回错误。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.