I have the following entry point:
public static void Main(string[] args)
{
var config = new ConfigurationBuilder()
.SetBasePath(Directory.GetCurrentDirectory())
.AddJsonFile("hosting.json", optional: true)
.AddCommandLine(args)
.AddEnvironmentVariables()
.Build();
var host = new WebHostBuilder()
.UseConfiguration(config)
.UseKestrel()
.UseContentRoot(Directory.GetCurrentDirectory())
.UseIISIntegration()
.UseStartup<Startup>()
.Build();
host.Run();
}
It works if I add hosting.json file like
{
"server.urls": "http://0.0.0.0:5001"
}
or if I define environment variable (have found name here)
SET ASPNETCORE_URLS=https://0.0.0.0:5001
But if I pass --server.urls http://0.0.0.0:5001
as parameter, the app listening the default 5000 port:
> dotnet run --server.urls http://0.0.0.0:5001
...
Now listening on: http://localhost:5000
The correct syntax is
dotnet run --server.urls=http://0.0.0.0:5001
instead of
dotnet run --server.urls http://0.0.0.0:5001
See the old answer for more details.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With