【问题标题】:Receiving "Error -4089 EAFNOSUPPORT address family not supported" in .Net Core 1.1 Web App on Azure在 Azure 上的 .Net Core 1.1 Web 应用程序中接收“错误 -4089 EAFNOSUPPORT 地址系列不支持”
【发布时间】:2017-04-13 18:48:23
【问题描述】:

我将在 .Net Core 1.1 中实现的 Web Api 作为应用服务发布到 Azure,但即使在浏览静态 html 文件时我仍会收到以下错误消息:

2016-11-29 16:43:05.594 +00:00 [Warning] Unable to bind to http://localhost:28243 on the IPv6 loopback interface.
System.AggregateException: One or more errors occurred. (Error -4089 EAFNOSUPPORT address family not supported) ---> Microsoft.AspNetCore.Server.Kestrel.Internal.Networking.UvException: Error -4089 EAFNOSUPPORT address family not supported
   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 -4089 EAFNOSUPPORT address family not supported
   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)<---

我用谷歌搜索了一下,发现 git 中有几个线程,但没有一个线程可以解决这个问题。例如其中一位建议上传 hosting.json 文件,但这也不是决定性的。任何想法如何解决这个问题?

【问题讨论】:

  • 您的Program.cs 或hosting.json 中是否有类似.UseUrls("http://*:28243") 的内容(如果您使用.UseConfiguration(...)``? If so, try using .UseUrls(")加载自定义hosting.json 并将其传递给WebHostBuilder 0.0.0.0:28243")? During one of the RC versions there was an issue where *:28343` 会导致它两次绑定到 IPv6
  • @Tseng 不,我根本没有这种东西。那么,我是否应该继续添加 .UseUrls("0.0.0.0:28243") 假设这可以解决问题?
  • 嗯,我在 DNX 期间遇到了类似的问题,这是由于将 * 通配符作为主机名。 github.com/aspnet/KestrelHttpServer/issues/766。你是在UseIISIntetgration() 之前还是之后打电话给UseKestrel()?顺序很重要,.UseIISIntegration() 需要在 UseKestrel() 之后调用,因为它会覆盖其设置
  • 我没有更改调用 UserKerstel() 的顺序。我一直使用与 Microsoft 生成的 .net 核心模板相同的代码。
  • @Tseng 我在代码中添加了 .UseUrls("0.0.0.0:28243") 并没有解决问题。我检查了日志文件,发现 Azure 决定使用另一个 Url,例如 localhost:26704。基本上它不遵守我在代码中包含的 URL。不知道是什么导致了这个问题!

标签: asp.net-core azure-web-app-service asp.net-core-webapi asp.net-core-1.1


【解决方案1】:

在解决方案根目录中检查 global.json 文件 - 你有 sdk 版本“1.1”吗?像

{
  "projects": [ "src", "test" ],
  "sdk": {
    "version": "1.0.0-preview2-1-003177"
  }
}

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2017-10-12
    • 2012-03-21
    • 1970-01-01
    • 2021-01-05
    • 1970-01-01
    • 2019-02-01
    • 2011-04-16
    • 1970-01-01
    相关资源
    最近更新 更多