Asp.Net Core application only listening to port 5000 on Ubuntu

Viewed 2061

I'm new to .Net Core. I have hosted my .Net core application in Ubuntu 18.04.5 LTS and mentioned the port needs to run in the service file.

[Unit]
Description=My Web Application

[Service]
WorkingDirectory=/var/www/myapp/idp/ums
ExecStart=/usr/bin/dotnet /var/www/myapp/idp/ums/myapp.dll --urls=http://localhost:6006
Restart=always
# Restart service after 10 seconds if the dotnet service crashes:
RestartSec=10
KillSignal=SIGINT
SyslogIdentifier=my-app-web
User=www-data
Environment=ASPNETCORE_ENVIRONMENT=Development
Environment=DOTNET_PRINT_TELEMETRY_MESSAGE=false

[Install]
WantedBy=multi-user.target

But it doesn't use the provided URL and always listening on port 5000.

enter image description here

I haven't mentioned port number 5000 anywhere in my application (not mentioned in launchSettings.json, or UserUrls in Program.cs).

I do have some other .Net core application in the same server and listens on the port provided in the service file.

Here are my application's Program.cs and startup method,

Porgram.cs

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>();
            });
}

Startup.cs

https://gist.github.com/Karthikeyan-tv/d2f93bb8d7d20ddc9dfbc1adac450c52

Is there any way to find out why the app is only listening on port 5000?

0 Answers
Related