我是.Net Core的新手。我已经将我的.Net核心应用程序托管在Ubuntu 18.04.5 LTS中,并提到该端口需要在服务文件中运行。
[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
但是它不使用提供的URL,并且始终在端口5000上侦听。
我在应用程序的任何地方都没有提到端口号5000(在launchSettings.json中没有提及,在Program.cs中没有提到UserUrls)。
我确实在同一台服务器上有其他一些.Net核心应用程序,并且在服务文件中提供的端口上进行监听。
这是我的应用程序的Program.cs和启动方法,
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
有什么方法可以找出为什么该应用程序只在端口5000上监听吗?