Can't connect to Azure Blob Storage from App Service - c#

I am trying to connect to a Azure Blob Storage account from an App Service hosted within the same location and in the same resource group. However when attempting to create a container during startup I get the following exception:
System.AggregateException: One or more errors occurred. (An error
occurred while sending the request.) --->
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
The inner exception is:
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
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Threading.Tasks.RendezvousAwaitable`1.GetResult()
at System.Net.Http.WinHttpHandler.d__105.MoveNext()
--- End of inner exception stack trace ---
I have double checked the account name, URL and access keys. I have also tried cycling the access keys to be sure. I have tried connecting to another storage account from the same app service and that also fails.
There are no app firewalls or VNets in place on either resource and I am at a loss as to what could be causing the issue.

Related

C# TMDbClient HttpRequestException: An error occurred while sending the request

I'm using the TMDbLib https://www.nuget.org/packages/TMDbLib/ 1.9.2 (upgraded due to error bellow) to grab info about TV shows. Until a day or so ago, this has been working.
Some aspects are still working. I've checked my API Key, and that is valid.
I'm getting the following errors
// Access to The Movie DB API
TMDbClient client = new TMDbClient(<API KEY>);
Error: but no exception
'client.Config' threw an exception of type 'System.InvalidOperationException'
Then
var NewEpisode = client.GetTvEpisodeAsync(TMDBid, SeasonNumber, Epnum).Result;
Error: with exceptions
This exception was originally thrown at this call stack:
[External Code]
Inner Exception 1:
HttpRequestException: An error occurred while sending the request.
Inner Exception 2:
WebException: The underlying connection was closed: An unexpected error occurred on a receive.
Inner Exception 3:
IOException: Unable to read data from the transport connection: An existing connection was forcibly closed by the remote host.
Inner Exception 4:
SocketException: An existing connection was forcibly closed by the remote host
Are these related, and how might I fix this? BTW I have Fast internet.
I think I've fixed this
Putting here in case someone else has similar issues
themoviedb.org uses TLS 1.3
Turns out I was using an older version of .NET framework that doesn't support TLS 1.3
Ref:
https://learn.microsoft.com/en-us/dotnet/framework/network-programming/tls
and
The request was aborted could not create SSL/TLS secure channel - HttpWebRequest
Uninstalled TMDBLib and System.Net.Http
Updated to newer .Net Framework
Reinstalled TMDBLib, System.Net.Http is a dependency so gets installed by default

how to know why WCF service stopped

We have developed WCF service and hosted as windows service. We have written .net core client application.
We have observed that the service is not responding after a few calls. It gets stopped somehow.
I tried to create logging and trace in WCF service but it is not creating any .svclog file.
In exception handling, it gives the following message
Exception: One or more errors occurred. (An error occurred while
sending the request.) System.ServiceModel.CommunicationException: An
error occurred while sending the request. --->
System.Net.Http.HttpRequestException: An error occurred while sending
the request. ---> System.IO.IOException: Unable to read data from the
transport connection: An existing connection was forcibly closed by
the remote host.. ---> System.Net.Sockets.SocketException (10054): An
existing connection was forcibly closed by the remote host. --- End
of inner exception stack trace --- at
System.Net.Sockets.Socket.AwaitableSocketAsyncEventArgs.ThrowException(SocketError
error, CancellationToken cancellationToken) at
System.Net.Sockets.Socket.AwaitableSocketAsyncEventArgs.GetResult(Int16
token) at
System.Net.Http.HttpConnection.SendAsyncCore(HttpRequestMessage
request, CancellationToken cancellationToken)
I want to know what forced the service to be stopped? How can I find this?

Getting "System.Net.WebException: The underlying connection was closed: The connection was closed unexpectedly." error while calling web api

In my application, there is a functionality to extract reports based on a date range. In the background, it is calling my Web API with authentication(A), which consists of api caller functionality using httpclient, which is calling another non-secured DMZ server API (B) and a DMZ API-caliing WCF service (C) to collect data from the database.
My problem is that whenever I select a large date range, I get the following error in my WebAPI (A).
System.Net.Http.HttpRequestException: An error occurred while sending the request. ---> System.Net.WebException: The underlying connection was closed: The connection was closed unexpectedly.
at System.Net.HttpWebRequest.EndGetResponse(IAsyncResult asyncResult)
at System.Net.Http.HttpClientHandler.GetResponseCallback(IAsyncResult ar)
--- End of inner exception stack trace ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd(Task task)
at System.Runtime.CompilerServices.TaskAwaiter`1.GetResult()
at LRAS.OrderServices.Core.Helpers.ApiCaller.d__4.MoveNext()
What I have tried: I have increased the httpclient timeout from 300 to 1000 seconds, but it is breaking nearly every minute.
You can try several methods:
1.Configure the service point security protocol and select the SecurityProtocolType that suits you (Tls12, Ssl3, Tls, Tls11).
ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12;
C# System.Net.WebException: The underlying connection was closed: An unexpected error occurred on a send
2.Set the ConnectionClose property of HttpClient.
_client.DefaultRequestHeaders.ConnectionClose = true;
HttpClient throwing "An error occurred while sending the request."
3.Try to hold the request long enough for it to complete normally and receive a valid response.
_client.DefaultRequestHeaders.Add("Connection", "Keep-Alive");
_client.DefaultRequestHeaders.Add("Keep-Alive", "3600");
.NET HttpClient - An existing connection was forcibly closed by the remote host

Xamarin-PCL iOS SignalR via Https Error

I've got a problem when using SignalR on Xamarin-PCL project. The error occurred when connection.start() (The hub url is https) method, But it's worked perfectly on Android.
This is the error message
System.AggregateException: One or more errors occurred. ---> System.Net.Http.HttpRequestException: An error occurred while sending the request ---> System.Net.WebException: Error getting response stream (ReadDone1): ReceiveFailure ---> System.IO.IOException: Unable to read data from the transport connection: Connection reset by peer. --->
Change the SSL/TLS implementation to "Mono (TLS v1.0)"

Request timed out on IIS

I am creating a payroll application and i have to do processing of over 500 employees. When I run the application on my local machine, it would run the application and produce correct information. It would take close to 3-4 mins to complete the processing of data. When i deploy my application to IIS and try to run it, i would get the following error below:
Server Error in '/' Application.
Request timed out.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.Web.HttpException: Request timed out.
Source Error:
An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.
Stack Trace:
[HttpException (0x80004005): Request timed out.]
I tried changing the connection time out (seconds) to 600 in the advance setting for IIS for that particular Site but that didnt work. Any suggestion?
Try to change web.config parameter <httpRuntime executionTimeout="90"/>
90 - is default value in seconds
you need to set greater value

Categories

Resources