When running Google.Cloud.Storage.V1 nuget package to upload file to Google Storage behind company's firewall, it hits exception "unable to read data from the transport connection: An existing connection was forcibly closed by the remote host.".
source: VMScaleSet windows VMs
destination: GCS
Nuget package: Google.Cloud.Storage.V1 2.3.0
Here is c# code, to upload local file to GCS.
StorageClient.Create().UploadObject(bucketName, objectName, null, stream);
Authentication has been set up following this guide https://cloud.google.com/storage/docs/reference/libraries#client-libraries-install-csharp
Everything works fine on local machine and on-premises serves in company. But does not work on Azure VMScaleSet VM. Firewall rule has been implemented between VMScaleSet and www.googleapis.com port 443. Azure VM is able to telnet www.googleapis.com 443
What else could be missing to establish connection?
Please help.
System.Net.Http.HttpRequestException: An error occurred while sending the
request. ---> System.Net.WebException: The underlying connection was
closed: An unexpected error occurred on a send. --->
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: An existing connection was forcibly
closed by the remote host
at System.Net.Sockets.Socket.EndReceive(IAsyncResult asyncResult)
at System.Net.Sockets.NetworkStream.EndRead(IAsyncResult asyncResult)
--- End of inner exception stack trace ---
at System.Net.TlsStream.EndWrite(IAsyncResult asyncResult)
at System.Net.ConnectStream.WriteHeadersCallback(IAsyncResult ar)
--- End of inner exception stack trace ---
at System.Net.HttpWebRequest.EndGetRequestStream(IAsyncResult
asyncResult, TransportContext& context)
at System.Net.Http.HttpClientHandler.GetRequestStreamCallback(IAsyncResult ar)
--- End of inner exception stack trace ---
at Google.Cloud.Storage.V1.StorageClientImpl.UploadHelper.CheckFinalProgress() in T:\src\github\google-cloud-dotnet\releasebuild\apis\Google.Cloud.Storage.V1\Google.Cloud.Storage.V1\StorageClientImpl.UploadObject.cs:line 202
at Google.Cloud.Storage.V1.StorageClientImpl.UploadHelper.Execute() in T:\src\github\google-cloud-dotnet\releasebuild\apis\Google.Cloud.Storage.V1\Google.Cloud.Storage.V1\StorageClientImpl.UploadObject.cs:line 154
at Google.Cloud.Storage.V1.StorageClientImpl.UploadObject(String bucket, String objectName, String contentType, Stream source, UploadObjectOptions options, IProgress`1 progress) in T:\src\github\google-cloud-dotnet\releasebuild\apis\Google.Cloud.Storage.V1\Google.Cloud.Storage.V1\StorageClientImpl.UploadObject.cs:line 70