Reputation: 1077
I have been using supervisor on ubuntu since dotnet 2 and have had no issues. Since my upgrade to dotnet version 3.1 I am getting an error saying port 5000 is in use when my supervisor file has always been configured to use 5001.
[program:myapi]]
command=/usr/bin/dotnet /var/www/api/api.dll --server.urls "http://*:5001"
directory=/var/www/api/
autostart=true
autorestart=true
stderr_logfile=/var/log/api.err.log
stdout_logfile=/var/log/api.out.log
environment=ASPNETCORE_ENVIRONMENT=Development
user=www-data
stopsignal=INT
I have another app running on 5000 which works fine but can't figure why after upgrading to 3.1 the port is defaulted to 5000 even when configured to use 5001.
Program.cs is pretty standard
public class Program
{
public static void Main(string[] args)
{
CreateHostBuilder(args).Build().Run();
}
public static IHostBuilder CreateHostBuilder(string[] args) =>
Host.CreateDefaultBuilder(args)
.ConfigureWebHostDefaults(webBuilder =>
{
webBuilder.UseStartup<Startup>();
});
}
Upvotes: 2
Views: 831
Reputation: 424
You need to change port in LaunchSettings.json file.
"{Your Project Name}": {
"commandName": "Project",
"launchBrowser": true,
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
},
"applicationUrl": "{http/https}://localhost:{Port No You want to change}/"
},
or in program.cs use following code
public static IWebHostBuilder CreateWebHostBuilder(string[] args) =>
WebHost.CreateDefaultBuilder(args)
.UseKestrel()
.UseContentRoot(Directory.GetCurrentDirectory())
.UseIISIntegration()
.UseStartup<Startup>()
.UseUrls("{https/http}://localhost:{Port No You want to change}/");
Upvotes: 2