我尝试不使用硬编码就配置host:port,但是Blazor服务器端应用程序在这种情况下无法启动?
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>()
.UseUrls(urls: new String[] { "http://*:6000", "https://localhost:6001" });
});
如果我取消呼叫.UseUrls(urls:new String [] {“ http:// *:6000”,“ https://localhost:6001”});开始 。怎么了? 我看到只有输出的控制台,但浏览器无法启动
Microsoft.Hosting.Lifetime:信息:正在侦听: http://[::]:6000 Microsoft.Hosting.Lifetime:信息:现在 监听:https://localhost:6001 Microsoft.Hosting.Lifetime: 信息:应用程序已启动。按Ctrl + C关闭。 Microsoft.Hosting.Lifetime:信息:托管环境: 开发Microsoft.Hosting.Lifetime:信息:内容根 路径:... Microsoft.Hosting.Lifetime:信息:应用程序为 关闭...