In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-03-26 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.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.