解决方法如下
方法1、
在Program.cs文件里,修改如下:
Program
{ Main([] args)
{
CreateWebHostBuilder(args).Build().Run();
}
IWebHostBuilder CreateWebHostBuilder(string[] args) =>
WebHost.CreateDefaultBuilder(args)
.UseStartup<Startup>()
.UseUrls("http://*:6600;https://*:6610");
}
方法2、
在appsettings.json 增加
"AllowedHosts": "*",
"Kestrel": {
"EndPoints": {
"Http": {
"Url": "http://*:6600"
}
}
},
这样就可以通过ip进行访问