centos 部署 asp.net core Error -99 EADDRNOTAVAIL address not available解决

centos7.3上部署 asp.net core 错误如下:

1 Hosting environment: Production
2 Content root path: /home/netcore
3 Now listening on: http://localhost:5000
4 Application started. Press Ctrl+C to shut down.
5 warn: Microsoft.AspNetCore.Server.Kestrel[0]
6 Unable to bind to http://localhost:5000 on the IPv6 loopback interface: 'Error -99 EADDRNOTAVAIL address not available'.

 

解决办法:

修改Program.cs文件指定运行url

 1 public class Program
 2     {
 3         public static void Main(string[] args)
 4         {
 5             BuildWebHost(args).Run();
 6         }
 7 
 8         public static IWebHost BuildWebHost(string[] args) =>
 9             WebHost.CreateDefaultBuilder(args)
10                 .UseStartup<Startup>()
11                 .UseUrls("http://*:8081")
12                 .Build();
13     }

 

posted @ 2017-08-17 11:38  程序小强  阅读(616)  评论(0编辑  收藏  举报