Google cloud storage 使用.NET的AWS SDK上载到Google云存储`预期哈希不等于计算哈希`

Google cloud storage 使用.NET的AWS SDK上载到Google云存储`预期哈希不等于计算哈希`,google-cloud-storage,aws-sdk-net,Google Cloud Storage,Aws Sdk Net,我正在尝试使用AWS SDK For.NET上传到Google云存储。我已在地面军事系统上启用互操作模式,并将AWSSecretKey和AWSAccessKey放入我的App.config中。我可以列出对象,但上传对我不起作用 我使用的代码是 AmazonS3Config c=newamazons3config(); c、 服务URL=”https://storage.googleapis.com"; 客户=新亚马逊3客户(c); PutObjectRequest=新建PutObjectRequ

我正在尝试使用AWS SDK For.NET上传到Google云存储。我已在地面军事系统上启用互操作模式,并将
AWSSecretKey
AWSAccessKey
放入我的App.config中。我可以列出对象,但上传对我不起作用

我使用的代码是

AmazonS3Config c=newamazons3config();
c、 服务URL=”https://storage.googleapis.com";
客户=新亚马逊3客户(c);
PutObjectRequest=新建PutObjectRequest()
{
ContentBody=“asdf”,
BucketName=BucketName,
Key=keyName
};
client.PutObject(请求);
但我得到的结果是:

Unhandled Exception:
Amazon.Runtime.AmazonClientException: Expected hash not equal to calculated hash
  at Amazon.S3.Internal.AmazonS3ResponseHandler.CompareHashes (System.String etag, System.Byte[] hash) [0x0003f] in <c4952b4c8b494e049894eba742a57891>:0
  at Amazon.S3.Internal.AmazonS3ResponseHandler.ProcessResponseHandlers (Amazon.Runtime.IExecutionContext executionContext) [0x00129] in <c4952b4c8b494e049894eba742a57891>:0
  at Amazon.S3.Internal.AmazonS3ResponseHandler.PostInvoke (Amazon.Runtime.IExecutionContext executionContext) [0x00000] in <c4952b4c8b494e049894eba742a57891>:0
  at Amazon.S3.Internal.AmazonS3ResponseHandler.InvokeSync (Amazon.Runtime.IExecutionContext executionContext) [0x00007] in <c4952b4c8b494e049894eba742a57891>:0
  at Amazon.Runtime.Internal.PipelineHandler.InvokeSync (Amazon.Runtime.IExecutionContext executionContext) [0x0000e] in <b8d5dfd6d5c84f7e87493f5d86f0adaa>:0
  at Amazon.Runtime.Internal.ErrorHandler.InvokeSync (Amazon.Runtime.IExecutionContext executionContext) [0x0001f] in <b8d5dfd6d5c84f7e87493f5d86f0adaa>:0
  at Amazon.Runtime.Internal.PipelineHandler.InvokeSync (Amazon.Runtime.IExecutionContext executionContext) [0x0000e] in <b8d5dfd6d5c84f7e87493f5d86f0adaa>:0
  at Amazon.Runtime.Internal.CallbackHandler.InvokeSync (Amazon.Runtime.IExecutionContext executionContext) [0x00007] in <b8d5dfd6d5c84f7e87493f5d86f0adaa>:0
  at Amazon.Runtime.Internal.PipelineHandler.InvokeSync (Amazon.Runtime.IExecutionContext executionContext) [0x0000e] in <b8d5dfd6d5c84f7e87493f5d86f0adaa>:0
  at Amazon.Runtime.Internal.Signer.InvokeSync (Amazon.Runtime.IExecutionContext executionContext) [0x00006] in <b8d5dfd6d5c84f7e87493f5d86f0adaa>:0
  at Amazon.Runtime.Internal.PipelineHandler.InvokeSync (Amazon.Runtime.IExecutionContext executionContext) [0x0000e] in <b8d5dfd6d5c84f7e87493f5d86f0adaa>:0
  at Amazon.Runtime.Internal.EndpointDiscoveryHandler.InvokeSync (Amazon.Runtime.IExecutionContext executionContext) [0x00030] in <b8d5dfd6d5c84f7e87493f5d86f0adaa>:0
  at Amazon.Runtime.Internal.PipelineHandler.InvokeSync (Amazon.Runtime.IExecutionContext executionContext) [0x0000e] in <b8d5dfd6d5c84f7e87493f5d86f0adaa>:0
  at Amazon.Runtime.Internal.CredentialsRetriever.InvokeSync (Amazon.Runtime.IExecutionContext executionContext) [0x00007] in <b8d5dfd6d5c84f7e87493f5d86f0adaa>:0
  at Amazon.Runtime.Internal.PipelineHandler.InvokeSync (Amazon.Runtime.IExecutionContext executionContext) [0x0000e] in <b8d5dfd6d5c84f7e87493f5d86f0adaa>:0
  at Amazon.Runtime.Internal.RetryHandler.InvokeSync (Amazon.Runtime.IExecutionContext executionContext) [0x00057] in <b8d5dfd6d5c84f7e87493f5d86f0adaa>:0
  at Amazon.Runtime.Internal.PipelineHandler.InvokeSync (Amazon.Runtime.IExecutionContext executionContext) [0x0000e] in <b8d5dfd6d5c84f7e87493f5d86f0adaa>:0
  at Amazon.Runtime.Internal.CallbackHandler.InvokeSync (Amazon.Runtime.IExecutionContext executionContext) [0x00007] in <b8d5dfd6d5c84f7e87493f5d86f0adaa>:0
  at Amazon.Runtime.Internal.PipelineHandler.InvokeSync (Amazon.Runtime.IExecutionContext executionContext) [0x0000e] in <b8d5dfd6d5c84f7e87493f5d86f0adaa>:0
  at Amazon.S3.Internal.AmazonS3KmsHandler.InvokeSync (Amazon.Runtime.IExecutionContext executionContext) [0x00007] in <c4952b4c8b494e049894eba742a57891>:0
  at Amazon.Runtime.Internal.PipelineHandler.InvokeSync (Amazon.Runtime.IExecutionContext executionContext) [0x0000e] in <b8d5dfd6d5c84f7e87493f5d86f0adaa>:0
  at Amazon.Runtime.Internal.EndpointResolver.InvokeSync (Amazon.Runtime.IExecutionContext executionContext) [0x00007] in <b8d5dfd6d5c84f7e87493f5d86f0adaa>:0
  at Amazon.Runtime.Internal.PipelineHandler.InvokeSync (Amazon.Runtime.IExecutionContext executionContext) [0x0000e] in <b8d5dfd6d5c84f7e87493f5d86f0adaa>:0
  at Amazon.S3.Internal.AmazonS3PostMarshallHandler.InvokeSync (Amazon.Runtime.IExecutionContext executionContext) [0x00007] in <c4952b4c8b494e049894eba742a57891>:0
  at Amazon.Runtime.Internal.PipelineHandler.InvokeSync (Amazon.Runtime.IExecutionContext executionContext) [0x0000e] in <b8d5dfd6d5c84f7e87493f5d86f0adaa>:0
  at Amazon.Runtime.Internal.Marshaller.InvokeSync (Amazon.Runtime.IExecutionContext executionContext) [0x00006] in <b8d5dfd6d5c84f7e87493f5d86f0adaa>:0
  at Amazon.Runtime.Internal.PipelineHandler.InvokeSync (Amazon.Runtime.IExecutionContext executionContext) [0x0000e] in <b8d5dfd6d5c84f7e87493f5d86f0adaa>:0
  at Amazon.S3.Internal.AmazonS3PreMarshallHandler.InvokeSync (Amazon.Runtime.IExecutionContext executionContext) [0x00007] in <c4952b4c8b494e049894eba742a57891>:0
  at Amazon.Runtime.Internal.PipelineHandler.InvokeSync (Amazon.Runtime.IExecutionContext executionContext) [0x0000e] in <b8d5dfd6d5c84f7e87493f5d86f0adaa>:0
  at Amazon.Runtime.Internal.CallbackHandler.InvokeSync (Amazon.Runtime.IExecutionContext executionContext) [0x00007] in <b8d5dfd6d5c84f7e87493f5d86f0adaa>:0
  at Amazon.Runtime.Internal.PipelineHandler.InvokeSync (Amazon.Runtime.IExecutionContext executionContext) [0x0000e] in <b8d5dfd6d5c84f7e87493f5d86f0adaa>:0
  at Amazon.S3.Internal.AmazonS3ExceptionHandler.InvokeSync (Amazon.Runtime.IExecutionContext executionContext) [0x00012] in <c4952b4c8b494e049894eba742a57891>:0
  at Amazon.Runtime.Internal.PipelineHandler.InvokeSync (Amazon.Runtime.IExecutionContext executionContext) [0x0000e] in <b8d5dfd6d5c84f7e87493f5d86f0adaa>:0
  at Amazon.Runtime.Internal.ErrorCallbackHandler.InvokeSync (Amazon.Runtime.IExecutionContext executionContext) [0x00012] in <b8d5dfd6d5c84f7e87493f5d86f0adaa>:0
  at Amazon.Runtime.Internal.PipelineHandler.InvokeSync (Amazon.Runtime.IExecutionContext executionContext) [0x0000e] in <b8d5dfd6d5c84f7e87493f5d86f0adaa>:0
  at Amazon.Runtime.Internal.MetricsHandler.InvokeSync (Amazon.Runtime.IExecutionContext executionContext) [0x0002b] in <b8d5dfd6d5c84f7e87493f5d86f0adaa>:0
  at Amazon.Runtime.Internal.RuntimePipeline.InvokeSync (Amazon.Runtime.IExecutionContext executionContext) [0x00006] in <b8d5dfd6d5c84f7e87493f5d86f0adaa>:0
  at Amazon.Runtime.AmazonServiceClient.Invoke[TResponse] (Amazon.Runtime.AmazonWebServiceRequest request, Amazon.Runtime.Internal.InvokeOptionsBase options) [0x0007d] in <b8d5dfd6d5c84f7e87493f5d86f0adaa>:0
  at Amazon.S3.AmazonS3Client.PutObject (Amazon.S3.Model.PutObjectRequest request) [0x0001c] in <c4952b4c8b494e049894eba742a57891>:0
  at GettingStartedGuide.S3Sample.Main (System.String[] args) [0x00059] in <52a410cf4a3b4fedb3f3e1dd35779339>:0
未处理的异常:
Amazon.Runtime.AmazonClientException:预期的哈希值不等于计算的哈希值
在Amazon.S3.Internal.AmazonS3ResponseHandler.comparehash(System.String etag,System.Byte[]散列)[0x0003f]中:0
位于Amazon.S3.Internal.AmazonS3ResponseHandler.ProcessResponseHandlers(Amazon.Runtime.IExecutionContext executionContext)[0x00129]中:0
在Amazon.S3.Internal.AmazonS3ResponseHandler.PostInvoke(Amazon.Runtime.IExecutionContext executionContext executionContext)[0x00000]中:0
在Amazon.S3.Internal.AmazonS3ResponseHandler.InvokeSync(Amazon.Runtime.IExecutionContext executionContext)[0x00007]中:0
在:0中的Amazon.Runtime.Internal.PipelineHandler.InvokeSync(Amazon.Runtime.IExecutionContext executionContext)[0x0000e]处
在:0中的Amazon.Runtime.Internal.ErrorHandler.InvokeSync(Amazon.Runtime.IExecutionContext executionContext executionContext)[0x0001f]处
在:0中的Amazon.Runtime.Internal.PipelineHandler.InvokeSync(Amazon.Runtime.IExecutionContext executionContext)[0x0000e]处
在:0中的Amazon.Runtime.Internal.CallbackHandler.InvokeSync(Amazon.Runtime.IExecutionContext executionContext executionContext)[0x00007]处
在:0中的Amazon.Runtime.Internal.PipelineHandler.InvokeSync(Amazon.Runtime.IExecutionContext executionContext)[0x0000e]处
在Amazon.Runtime.Internal.Signer.InvokeSync(Amazon.Runtime.IExecutionContext executionContext executionContext)[0x00006]中:0
在:0中的Amazon.Runtime.Internal.PipelineHandler.InvokeSync(Amazon.Runtime.IExecutionContext executionContext)[0x0000e]处
在:0中的Amazon.Runtime.Internal.EndpointDiscoveryHandler.InvokeSync(Amazon.Runtime.IExecutionContext executionContext executionContext)[0x00030]处
在:0中的Amazon.Runtime.Internal.PipelineHandler.InvokeSync(Amazon.Runtime.IExecutionContext executionContext)[0x0000e]处
在:0中的Amazon.Runtime.Internal.CredentialsRetriever.InvokeSync(Amazon.Runtime.IExecutionContext executionContext executionContext)[0x00007]处
在:0中的Amazon.Runtime.Internal.PipelineHandler.InvokeSync(Amazon.Runtime.IExecutionContext executionContext)[0x0000e]处
在:0中的Amazon.Runtime.Internal.RetryHandler.InvokeSync(Amazon.Runtime.IExecutionContext executionContext executionContext)[0x00057]处
在:0中的Amazon.Runtime.Internal.PipelineHandler.InvokeSync(Amazon.Runtime.IExecutionContext executionContext)[0x0000e]处
在:0中的Amazon.Runtime.Internal.CallbackHandler.InvokeSync(Amazon.Runtime.IExecutionContext executionContext executionContext)[0x00007]处
在:0中的Amazon.Runtime.Internal.PipelineHandler.InvokeSync(Amazon.Runtime.IExecutionContext executionContext)[0x0000e]处
在:0中的Amazon.S3.Internal.AmazonS3KmsHandler.InvokeSync(Amazon.Runtime.IExecutionContext executionContext executionContext)[0x00007]处
在:0中的Amazon.Runtime.Internal.PipelineHandler.InvokeSync(Amazon.Runtime.IExecutionContext executionContext)[0x0000e]处
在:0中的Amazon.Runtime.Internal.EndpointResolver.InvokeSync(Amazon.Runtime.IExecutionContext executionContext)[0x00007]处
在:0中的Amazon.Runtime.Internal.PipelineHandler.InvokeSync(Amazon.Runtime.IExecutionContext executionContext)[0x0000e]处
在Amazon.S3.Internal.AmazonS3PostMarshallHandler.InvokeSync(Amazon.Runtime.IExecutionContext executionContext)[0x00007]中:0
在:0中的Amazon.Runtime.Internal.PipelineHandler.InvokeSync(Amazon.Runtime.IExecutionContext executionContext)[0x0000e]处
在Amazon.Runtime.Internal.Marshaller.InvokeSync(Amazon.Runtime.IExecutionContext executionContext executionContext)[0x00006]中:0
在:0中的Amazon.Runtime.Internal.PipelineHandler.InvokeSync(Amazon.Runtime.IExecutionContext executionContext)[0x0000e]处
在Amazon.S3.Internal.AmazonS3PreMarshallHandler.InvokeSync(Amazon.Runtime.IExecutionContext executionContext)[0x00007]中:0
在:0中的Amazon.Runtime.Internal.PipelineHandler.InvokeSync(Amazon.Runtime.IExecutionContext executionContext)[0x0000e]处
在:0中的Amazon.Runtime.Internal.CallbackHandler.InvokeSync(Amazon.Runtime.IExecutionContext executionContext executionContext)[0x00007]处
在:0中的Amazon.Runtime.Internal.PipelineHandler.InvokeSync(Amazon.Runtime.IExecutionContext executionContext)[0x0000e]处
在Amazon.S3.Internal.AmazonS3ExceptionHandler.InvokeSync(Amazon.Runtime.IExecutionContext executionContext executionContext)[0x00012]中:0
在:0中的Amazon.Runtime.Internal.PipelineHandler.InvokeSync(Amazon.Runtime.IExecutionContext executionContext)[0x0000e]处
在:0中的Amazon.Runtime.Internal.ErrorCallbackHandler.InvokeSync(Amazon.Runtime.IExecutionContext executionContext executionContext)[0x00012]处
在:0中的Amazon.Runtime.Internal.PipelineHandler.InvokeSync(Amazon.Runtime.IExecutionContext executionContext)[0x0000e]处
在:0中的Amazon.Runtime.Internal.MetricsHandler.InvokeSync(Amazon.Runtime.IExecutionContext executionContext executionContext)[0x0002b]处
在:0中的Amazon.Runtime.Internal.RuntimePipeline.InvokeSync(Amazon.Runtime.IExecutionContext executionContext)[0x00006]处
在Amazon.Runtime.AmazonServiceClient.Invoke[TreResponse](Amazon.Runtime.AmazonWebServiceRequest请求,Amazon.Runtime.Internal.InvokeOptions)中[0x0007d]输入:0
在Amazon.S3.AmazonS3Client.PutObject(Amazon.S3.Model.PutObjectRequest请求)[0x0001c]中:0
在0中的GettingStartedGuide.S3Sample.Main(System.String[]args)[0x00059]处
同样的代码也适用于S3(减去设置ServiceURL)