运行Google.Cloud.Storage.V1 nuget程序包将文件上传到公司防火墙后的Google Storage时,出现异常“无法从传输连接读取数据:远程主机强行关闭了现有连接”。
source: VMScaleSet windows VMs
destination: GCS
Nuget package: Google.Cloud.Storage.V1 2.3.0
这是c#代码,用于将本地文件上传到GCS。
StorageClient.Create().UploadObject(bucketName, objectName, null, stream);
已按照本指南https://cloud.google.com/storage/docs/reference/libraries#client-libraries-install-csharp
设置了身份验证一切都可以在本地计算机上正常工作,并且本地公司也可以提供服务。 但不适用于Azure VMScaleSet VM。 已在VMScaleSet和www.googleapis.com端口443之间实现了防火墙规则。AzureVM能够远程登录www.googleapis.com 443
建立连接可能还会缺少什么?
请帮助。
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