2017-05-13 2 views
2

Ich habe ein .NET Core 1.1 Web API-Projekt, das gut funktioniert lokal. Sobald ich es in Azure auf AppService deployed habe, wird es auf keine GET-Anfragen antworten - sie haben keine Zeit mehr. Ich habe einen offenen Ping-Endpunkt, der einfach das aktuelle Datum und die aktuelle Uhrzeit zurückgibt und nicht antwortet. Mit Blick auf die Protokolle sehe ich das:.NET Core Web Api-Fehler -4090 EADDRNOTAVAIL-Adresse nicht verfügbar auf Azure

[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)<--- 

Ich bin mir nicht sicher, warum das passiert und wie man es löst.

EDIT: Hier ist die 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(); 
    } 
+0

zeigen, wie Sie den Host konfigurieren (standardmäßig - Methode 'Main' in der Datei Program.cs). Haben Sie ".UseAzureAppServices()" dort hinzugefügt? – Set

+0

Hinzugefügt Programm.cs. Ich habe UseAzureAppServices() nicht verwendet. Ist das erforderlich? – Mensur

+0

Ich fügte die Abhängigkeit hinzu und fügte einen Aufruf zu UseAzureAppServices() hinzu, aber es machte keinen Unterschied. – Mensur

Antwort

1

Dies stellte ein Problem mit meiner Firewall zu sein. Die Nachricht im Protokoll ist nur eine Warnung und scheint die normale Verarbeitung nicht zu beeinträchtigen.

0

Hatte das gleiche Problem mit ASP.NET Core 2.0. Geben Sie explizit die URLs an, die der Host überwachen soll:

public static IWebHost BuildWebHost(string[] args) 
{ 
    return WebHost 
       .CreateDefaultBuilder(args) 
       .UseUrls("http://+:22676") // <--add urls 
       .UseStartup<Startup>() 
       .Build(); 
} 
Verwandte Themen