This article is a mirror article of machine translation, please click here to jump to the original article.

View: 32353|Reply: 0

[.NET Core] asp.net Core 3.1 command line to start the dynamic listening port

[Copy link]
Posted on 2021-1-23 12:03:44 | | | |
When doing distributed applications, we need to start the same application multiple times, which may cause port occupancy, how can we dynamically modify the ports listened to by asp.net core applications through the command line?

introduction

When doing distributed applications, we need to start the same application multiple times, which may cause port occupancy, how can we dynamically modify the ports listened to by asp.net core applications through the command line?

initiate

asp.net core 3.1 project, the Kestrel web server is used by default.

Kestrel is a cross-platform web server for ASP.NET Core. Kestrel is a web server that is included by default in the ASP.NET Core project template.

Kestrel supports the following scenarios:

  • HTTPS
  • Opaque upgrades to enable WebSockets
  • Unix sockets for getting the high performance of Nginx
  • HTTP/2 (except macOS†)


The hyperlink login is visible.

Kestrel provides the --urls command line argument.





View via browser:

http://127.0.0.1:8089/WeatherForecast



To modify the Program file:

If you do not specify the urls parameter, the default listening port of the project is 1250, as shown in the figure below:




(End)




Previous:.net/c# enables 100% CPU processor usage
Next:Intelligent domain name wildcard DNS lookup
Disclaimer:
All software, programming materials or articles published by Code Farmer Network are only for learning and research purposes; The above content shall not be used for commercial or illegal purposes, otherwise, users shall bear all consequences. The information on this site comes from the Internet, and copyright disputes have nothing to do with this site. You must completely delete the above content from your computer within 24 hours of downloading. If you like the program, please support genuine software, purchase registration, and get better genuine services. If there is any infringement, please contact us by email.

Mail To:help@itsvse.com