In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-09-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/02 Report--
This article focuses on "how to change the default port number of asp.net core5 programs". Interested friends may wish to have a look at it. The method introduced in this paper is simple, fast and practical. Let's let the editor take you to learn how to change the default port number of asp.net core5 programs.
In the local development environment, we know that port switching can be achieved by changing the port number in the launchSettings.json file.
"WebApplication1": {"commandName": "Project", "launchBrowser": true, "launchUrl": "weatherforecast", "environmentVariables": {"ASPNETCORE_ENVIRONMENT": "Development"}, "applicationUrl": "https://*:8081;http://*:8080"}"
But after the release of the program, I found that it has been listening to port 5000, I would like to ask how I do port changes in the production environment, I tried UseUrls does not seem to work.
Public static IHostBuilder CreateHostBuilder (string [] args) = > Host.CreateDefaultBuilder (args) .ConfigureServices ((hostContext, services) = > {services.AddHostedService () }) .UseWindowsService () .ConfigureWebHostDefaults (webBuilder = > {webBuilder.UseStartup () .UseUrls ("http://*:8080","https://*:8081");})) .UseSerilog ()
It's okay to use UseUrls, but you reverse the order. Just swap webBuilder.UseStartup () with .UseUrls ("http://*:8080","https://*:8081")). I hope it works for you.
Public static IHostBuilder CreateHostBuilder (string [] args) = > Host.CreateDefaultBuilder (args) .ConfigureServices ((hostContext, services) = > {services.AddHostedService () }) .UseWindowsService () .ConfigureWebHostDefaults (webBuilder = > {webBuilder.UseUrls ("https://*:8081"," http://*:8080"); webBuilder.UseStartup ();}) .UseSerilog ();}
Stephen LAI:
You can configure it through the command line-- urls parameter when the program starts, as shown below:
Dotnet run-urls "http://localhost:5100;https://localhost:5101"
Or:
Dotnet / Product/Full/Path/Product.dll-- urls "http://localhost:5100;https://localhost:5101"
If we must manipulate the LaunchSettings.json file, it can also be achieved, just configure the iisSettings node.
{"iisSettings": {"iisExpress": {"applicationUrl": "http://localhost:8080"," sslPort ": 96085
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
The market share of Chrome browser on the desktop has exceeded 70%, and users are complaining about
The world's first 2nm mobile chip: Samsung Exynos 2600 is ready for mass production.According to a r
A US federal judge has ruled that Google can keep its Chrome browser, but it will be prohibited from
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
About us Contact us Product review car news thenatureplanet
More Form oMedia: AutoTimes. Bestcoffee. SL News. Jarebook. Coffee Hunters. Sundaily. Modezone. NNB. Coffee. Game News. FrontStreet. GGAMEN
© 2024 shulou.com SLNews company. All rights reserved.