【发布时间】:2020-05-22 23:04:12
【问题描述】:
这是我的 Program.CS
public static void Main(string[] args)
{
CreateHostBuilder(args).Build().Run();
}
public static IHostBuilder CreateHostBuilder(string[] args) =>
Host.CreateDefaultBuilder(args)
.UseSerilog()
.ConfigureWebHostDefaults(webBuilder =>
{
webBuilder.ConfigureKestrel(serverOptions =>
{
// Set properties and call methods on options
})
.UseKestrel()
.UseIISIntegration()
.UseStartup<Startup>();
})
.ConfigureAppConfiguration((hostingContext, config) =>
{
config.AddJsonFile("appsettings.local.json", optional: true, reloadOnChange: true);
config.AddCommandLine(args);
});
}
我正在通过以下命令运行应用程序:
dotnet run --server.urls http://localhost:59708
但是,该应用程序只会侦听端口 59707,而不是端口 59708。我正在尝试使用命令行参数设置端口,以便可以在单独的静态端口上运行应用程序的多个实例
【问题讨论】:
标签: c# .net .net-core kestrel-http-server kestrel