我有一个.NET Core1.1WebApi项目,它在本地运行得很好。一旦我将它部署到Azure上的AppService,它将不会响应任何GET请求-它们都超时了。我有一个开放的ping端点,它只返回当前日期和时间,但没有响应。查看日志,我看到了以下内容:
[INF] Azure Web Sites environment detected. Using '"D:\home\ASP.NET\DataProtection-Keys"' as key repository; keys will not be encrypted at rest. (383ad3af)
[WRN] Unable to bind to http://localhost:22676 on the IPv6 loopback interface. (de7f78a0)
System.AggregateException: One or more errors occurred. (Error -4090 EADDRNOTAVAIL address not available) ---> Microsoft.AspNetCore.Server.Kestrel.Internal.Networking.UvException: Error -4090 EADDRNOTAVAIL address not available
at Microsoft.AspNetCore.Server.Kestrel.Internal.Networking.Libuv.tcp_bind(UvTcpHandle handle, SockAddr& addr, Int32 flags)
at Microsoft.AspNetCore.Server.Kestrel.Internal.Networking.UvTcpHandle.Bind(ServerAddress address)
at Microsoft.AspNetCore.Server.Kestrel.Internal.Http.TcpListener.CreateListenSocket()
at Microsoft.AspNetCore.Server.Kestrel.Internal.Http.Listener.<StartAsync>b__8_0(Object state)
--- End of inner exception stack trace ---
at System.Threading.Tasks.Task.ThrowIfExceptional(Boolean includeTaskCanceledExceptions)
at System.Threading.Tasks.Task.Wait(Int32 millisecondsTimeout, CancellationToken cancellationToken)
at System.Threading.Tasks.Task.Wait()
at Microsoft.AspNetCore.Server.Kestrel.Internal.KestrelEngine.CreateServer(ServerAddress address)
at Microsoft.AspNetCore.Server.Kestrel.KestrelServer.Start[TContext](IHttpApplication`1 application)
---> (Inner Exception #0) Microsoft.AspNetCore.Server.Kestrel.Internal.Networking.UvException: Error -4090 EADDRNOTAVAIL address not available
at Microsoft.AspNetCore.Server.Kestrel.Internal.Networking.Libuv.tcp_bind(UvTcpHandle handle, SockAddr& addr, Int32 flags)
at Microsoft.AspNetCore.Server.Kestrel.Internal.Networking.UvTcpHandle.Bind(ServerAddress address)
at Microsoft.AspNetCore.Server.Kestrel.Internal.Http.TcpListener.CreateListenSocket()
at Microsoft.AspNetCore.Server.Kestrel.Internal.Http.Listener.<StartAsync>b__8_0(Object state)<---我不确定为什么会发生这种情况,以及如何解决它。
编辑:这是Program.cs
public static void Main(string[] args)
{
var configuration = new ConfigurationBuilder()
.AddEnvironmentVariables()
.AddCommandLine(args)
.Build();
var host = new WebHostBuilder()
.ConfigureLogging(options => options.AddConsole())
.ConfigureLogging(options => options.AddDebug())
.UseConfiguration(configuration)
.UseIISIntegration()
.UseKestrel(options =>
{
options.ThreadCount = 1;
})
.UseStartup<Startup>()
.Build();
host.Run();
}发布于 2018-02-06 00:24:20
在ASP.NET Core2.0上也有同样的问题。显式指定主机将侦听的urls:
public static IWebHost BuildWebHost(string[] args)
{
return WebHost
.CreateDefaultBuilder(args)
.UseUrls("http://+:22676") // <--add urls
.UseStartup<Startup>()
.Build();
}发布于 2017-05-19 11:36:22
这成了我的防火墙的一个问题。日志中的消息只是一个警告,似乎不会干扰正常的处理。
https://stackoverflow.com/questions/43948847
复制相似问题