引用单元
解决办法:在Program.cs文件里,修改如下:
Program { Main([] args) { CreateWebHostBuilder(args).Build().Run(); } IWebHostBuilder CreateWebHostBuilder(string[] args) => WebHost.CreateDefaultBuilder(args) .UseStartup<Startup>() .UseUrls("http://*:5000;https://*:5001"); }
For .net6 later:
builder.WebHost.UseUrls(new[] { "http://*:5000", "https://*:5001" });
http://*:5000;https://*:5001。*代表任何地址