首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >.NET核心网络Api错误-4090 EADDRNOTAVAIL地址在Azure上不可用

.NET核心网络Api错误-4090 EADDRNOTAVAIL地址在Azure上不可用
EN

Stack Overflow用户
提问于 2017-05-13 11:13:05
回答 2查看 3.2K关注 0票数 4

我有一个.NET Core1.1WebApi项目,它在本地运行得很好。一旦我将它部署到Azure上的AppService,它将不会响应任何GET请求-它们都超时了。我有一个开放的ping端点,它只返回当前日期和时间,但没有响应。查看日志,我看到了以下内容:

代码语言:javascript
复制
[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

代码语言:javascript
复制
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();
    }
EN

回答 2

Stack Overflow用户

发布于 2018-02-06 00:24:20

在ASP.NET Core2.0上也有同样的问题。显式指定主机将侦听的urls:

代码语言:javascript
复制
public static IWebHost BuildWebHost(string[] args)
{
    return WebHost
                .CreateDefaultBuilder(args)
                .UseUrls("http://+:22676") // <--add urls
                .UseStartup<Startup>()
                .Build();
}
票数 5
EN

Stack Overflow用户

发布于 2017-05-19 11:36:22

这成了我的防火墙的一个问题。日志中的消息只是一个警告,似乎不会干扰正常的处理。

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/43948847

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档