简体   繁体   English

在As.net.Core 中,我们可以更改端口号吗?

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

相关问题 如何在 AspNet.Core 中读取 EXIF 数据 - How can i read EXIF data in AspNet.Core 用于集成测试的ASPNet.Core HostingEnvironment? - ASPNet.Core HostingEnvironment for Integration Tests? 如何将.NetFramework 中的MessageHandler 转换为AspNet.Core - How to convert MessageHandler in .NetFramework to AspNet.Core 使用Angular时,无法获取aspnet.core服务器路由以默认路径加载 - Can't get aspnet.core server route to load with default path, when using Angular Aspnet.core 程序登录但考虑同一个表中的数据 - The Aspnet.core program logs in but considers the data in the same table 是否可以为ASPNET.Core OData声明多个路由 - Is it possible to declare multiple routes for ASPNET.Core OData ASPNet.Core 从引用的程序集中读取 appsettings? - ASPNet.Core reading appsettings from referenced assemblies? 如何在aspnet.core web api中验证JWT令牌? - How to validate JWT Token in aspnet.core web api? aspnet.core 使用 UserManager 播种数据<identityuser></identityuser> - aspnet.core Seeding data using UserManager<IdentityUser> 如何在ASPNET.Core Web应用程序中使用CORS标头发送HTTP 4xx-5xx响应? - How to send an HTTP 4xx-5xx response with CORS headers in an ASPNET.Core web app?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM