System.Net.Http.WinHttpException: 'A connection with the server could not be established'
I am diving into the Azure Functions pool here, and have created a v2 project from scratch with Anonymous authorization and Storage Emulator. Simply hitting F5 after this, I get intermittent errors with the following message:
System.Net.Http.WinHttpException: 'A connection with the server could not be established'
Not sure if this is a known issue, but wanted to make sure it's captured and hopefully track it down. Obviously not a good feeling/experience seeing an error being thrown every few seconds when starting a simple, new project. 😆
FWIW, here's a sample of what I am seeing from the debug output:
Exception thrown: 'System.Net.Http.WinHttpException' in System.Private.CoreLib.dll
Exception thrown: 'System.Net.Http.HttpRequestException' in System.Private.CoreLib.dll
Exception thrown: 'System.Net.Http.HttpRequestException' in System.Net.Http.dll
Exception thrown: 'System.Net.Http.HttpRequestException' in System.Private.CoreLib.dll
Exception thrown: 'System.Net.Http.HttpRequestException' in System.Net.Http.dll
Exception thrown: 'System.Net.Http.HttpRequestException' in System.Private.CoreLib.dll
Exception thrown: 'Microsoft.WindowsAzure.Storage.StorageException' in Microsoft.WindowsAzure.Storage.dll
Exception thrown: 'Microsoft.WindowsAzure.Storage.StorageException' in System.Private.CoreLib.dll
Exception thrown: 'Microsoft.WindowsAzure.Storage.StorageException' in System.Private.CoreLib.dll
Exception thrown: 'System.InvalidOperationException' in Microsoft.Azure.WebJobs.Host.dll
Exception thrown: 'System.InvalidOperationException' in System.Private.CoreLib.dll
Exception thrown: 'System.InvalidOperationException' in System.Private.CoreLib.dll
Exception thrown: 'System.InvalidOperationException' in System.Private.CoreLib.dll
Exception thrown: 'System.InvalidOperationException' in System.Private.CoreLib.dll
Exception thrown: 'System.AggregateException' in System.Private.CoreLib.dll
Exception thrown: 'System.AggregateException' in System.Private.CoreLib.dll
Exception thrown: 'System.Net.Http.WinHttpException' in System.Private.CoreLib.dll
Exception thrown: 'System.Net.Http.HttpRequestException' in System.Private.CoreLib.dll
Exception thrown: 'System.Net.Http.HttpRequestException' in System.Net.Http.dll
Exception thrown: 'System.Net.Http.HttpRequestException' in System.Private.CoreLib.dll
Exception thrown: 'System.Net.Http.HttpRequestException' in System.Net.Http.dll
Exception thrown: 'System.Net.Http.HttpRequestException' in System.Private.CoreLib.dll
Exception thrown: 'System.Net.Http.WinHttpException' in System.Private.CoreLib.dll
Exception thrown: 'System.Net.Http.HttpRequestException' in System.Private.CoreLib.dll
Exception thrown: 'System.Net.Http.HttpRequestException' in System.Net.Http.dll
Exception thrown: 'System.Net.Http.HttpRequestException' in System.Private.CoreLib.dll
Exception thrown: 'System.Net.Http.HttpRequestException' in System.Net.Http.dll
Exception thrown: 'System.Net.Http.HttpRequestException' in System.Private.CoreLib.dll
Just noticed another error, not sure if it's related and/or known issue.
Error writing logs to table storage: Microsoft.WindowsAzure.Storage.StorageException: An error occurred while sending the request. ---> System.Net.Http.HttpRequestException: An error occurred while sending the request. ---> System.Net.Http.WinHttpException: A connection with the server could not be established
[3/21/2018 9:23:10 AM] at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
[3/21/2018 9:23:10 AM] at System.Threading.Tasks.RendezvousAwaitable`1.GetResult()
[3/21/2018 9:23:10 AM] at System.Net.Http.WinHttpHandler.<StartRequest>d__105.MoveNext()
[3/21/2018 9:23:10 AM] --- End of inner exception stack trace ---
[3/21/2018 9:23:10 AM] at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
[3/21/2018 9:23:10 AM] at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
[3/21/2018 9:23:10 AM] at System.Runtime.CompilerServices.ConfiguredTaskAwaitable`1.ConfiguredTaskAwaiter.GetResult()
[3/21/2018 9:23:10 AM] at System.Net.Http.DiagnosticsHandler.<SendAsync>d__2.MoveNext()
[3/21/2018 9:23:10 AM] --- End of stack trace from previous location where exception was thrown ---
[3/21/2018 9:23:10 AM] at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
[3/21/2018 9:23:10 AM] at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
[3/21/2018 9:23:10 AM] at System.Runtime.CompilerServices.ConfiguredTaskAwaitable`1.ConfiguredTaskAwaiter.GetResult()
[3/21/2018 9:23:10 AM] at System.Net.Http.HttpClient.<FinishSendAsyncUnbuffered>d__59.MoveNext()
[3/21/2018 9:23:10 AM] --- End of stack trace from previous location where exception was thrown ---
[3/21/2018 9:23:10 AM] at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
[3/21/2018 9:23:10 AM] at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
[3/21/2018 9:23:10 AM] at Microsoft.WindowsAzure.Storage.Core.Executor.Executor.<ExecuteAsyncInternal>d__4`1.MoveNext()
[3/21/2018 9:23:10 AM] --- End of inner exception stack trace ---
[3/21/2018 9:23:10 AM] at Microsoft.WindowsAzure.Storage.Core.Executor.Executor.<ExecuteAsyncInternal>d__4`1.MoveNext()
[3/21/2018 9:23:10 AM] --- End of stack trace from previous location where exception was thrown ---
[3/21/2018 9:23:10 AM] at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
[3/21/2018 9:23:10 AM] at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
[3/21/2018 9:23:10 AM] at Microsoft.WindowsAzure.Storage.Table.TableBatchOperation.<>c__DisplayClass36_0.<<ExecuteAsync>b__0>d.MoveNext()
[3/21/2018 9:23:10 AM] --- End of stack trace from previous location where exception was thrown ---
[3/21/2018 9:23:10 AM] at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
[3/21/2018 9:23:10 AM] at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
[3/21/2018 9:23:10 AM] at System.Runtime.CompilerServices.TaskAwaiter`1.GetResult()
[3/21/2018 9:23:10 AM] at Microsoft.Azure.WebJobs.Logging.Utility.<SafeExecuteAsync>d__7.MoveNext()
[3/21/2018 9:23:10 AM] --- End of stack trace from previous location where exception was thrown ---
[3/21/2018 9:23:10 AM] at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
[3/21/2018 9:23:10 AM] at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
[3/21/2018 9:23:10 AM] at Microsoft.Azure.WebJobs.Logging.Utility.<WriteBatchAsync>d__9`1.MoveNext()
[3/21/2018 9:23:10 AM] --- End of stack trace from previous location where exception was thrown ---
[3/21/2018 9:23:10 AM] at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
[3/21/2018 9:23:10 AM] at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
[3/21/2018 9:23:10 AM] at Microsoft.Azure.WebJobs.Logging.LogWriter.<FlushTimelineAggregateAsync>d__22.MoveNext()
[3/21/2018 9:23:10 AM] --- End of stack trace from previous location where exception was thrown ---
[3/21/2018 9:23:10 AM] at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
[3/21/2018 9:23:10 AM] at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
[3/21/2018 9:23:10 AM] at Microsoft.Azure.WebJobs.Logging.LogWriter.<FlushCoreAsync>d__25.MoveNext()
[3/21/2018 9:23:10 AM] Request Information
[3/21/2018 9:23:10 AM] RequestID:
[3/21/2018 9:23:10 AM] RequestDate:
[3/21/2018 9:23:10 AM] StatusMessage:
[3/21/2018 9:23:10 AM]
[3/21/2018 9:23:10 AM] Microsoft.WindowsAzure.Storage: An error occurred while sending the request. System.Private.CoreLib: An error occurred while sending the request. System.Private.CoreLib: A connection with the server could not be established.
Same problem over here. I have a function triggered by a queue. This function calls HttpClient's GetAsync several times with await. It keeps failing with that same message. It doesn't always fail. There's a 10% chance it will get that error. I have no clue why. The function retry mechanism is working so no real harm so far.
Any help would be appreciated :)
I'm also having this issue with Azure Functions when connecting to Table and Document DB. Hoping someone can find a solution to this or I can soon, since the retry mechanism isn't going to work for my solution :-/
Is this still relevant? Lots of changes have happened to v2 since this was posted (apologies for the delay)
I cannot speak for others but I have not had the opportunity to try this out lately. I am OK with waiting for feedback from others and if no one else chimes in we can close it until I get the opportunity.
Sorry, but I haven't touched that project in a long time. I have no idea if it's still an issue.
Hi, I have developed the function app v2 with Service bus trigger - https://oneprofilesyncappeus.azurewebsites.net and deployed to the production three weeks back and seeing this issue being logged from 22nd Dec in the App insight. As per the error message and stack trace I see this error happening in the Azure function module well before message is received in my programming module.
Error Message: Error while copying content to a stream. The write operation failed, see inner exception. Error 12030 calling WinHttpWriteData, 'The connection with the server was terminated abnormally'.
Stack Trace
System.Net.Http.HttpRequestException:
at System.Net.Http.HttpContent+
@fabiocav Can you help me triage this?
@fabiocav ping
We get the similar issue intermittently when file is moved to ADLS . Any update on this?
System.Net.Http.HttpRequestException:
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw (System.Private.CoreLib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e)
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess (System.Private.CoreLib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (System.Private.CoreLib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e)
at System.Runtime.CompilerServices.ConfiguredTaskAwaitable1+ConfiguredTaskAwaiter.GetResult (System.Private.CoreLib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e)
at System.Net.Http.DiagnosticsHandler+<SendAsync>d__2.MoveNext (System.Net.Http, Version=4.2.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a)
Inner exception System.Net.Http.WinHttpException handled at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw:
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw (System.Private.CoreLib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e)
at System.Threading.Tasks.RendezvousAwaitable1.GetResult (System.Net.Http, Version=4.2.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a)
at System.Net.Http.WinHttpHandler+