简体   繁体   English

使用Amazon .NET SDK时出错

[英]Error while using Amazon .NET SDK

I installed .NET SDK and in Visual Studio, selected New Project -> AWS -> Storage and Content Delivery -> AWS S3 Sample. 我安装了.NET SDK,并在Visual Studio中选择了New Project-> AWS-> Storage and Content Delivery-> AWS S3 Sample。 Given below is my code. 下面是我的代码。

using (client = Amazon.AWSClientFactory.CreateAmazonS3Client())
{
    ListBucketsResponse response = client.ListBuckets();
}

My app.config has 3 values: 我的app.config具有3个值:

<add key="AWSAccessKey" value="xxxx"/>
<add key="AWSSecretKey" value="xxxxxxxx"/>
<add key="AWSRegion" value="us-east-1"/>

I get following exception at the statement: 我在声明中得到以下异常:

ListBucketsResponse response = client.ListBuckets();

Exception 例外

The request signature we calculated does not match the signature you provided. 我们计算出的请求签名与您提供的签名不匹配。 Check your key and signing method. 检查您的密钥和签名方法。

Inner Exception 内部异常

The remote server returned an error: (403) Forbidden. 远程服务器返回错误:(403)禁止。

Please help. 请帮忙。

Not sure if you figured this out yet, but I can confirm that your code is working 100% when I substitute my credentials instead. 不知道您是否已解决此问题,但是当我替换我的凭据时,我可以确认您的代码正在100%运行。

If you are sure your credentials are correct, then make sure you have the newest .net sdk installed and try again - just tried it myself with version 2.0.15.1 available here: 如果您确定自己的凭据正确无误,请确保已安装最新的.net sdk,然后重试-自己尝试使用此处提供的2.0.15.1版本:

http://sdk-for-net.amazonwebservices.com/latest/AWSToolsAndSDKForNet.msi http://sdk-for-net.amazonwebservices.com/latest/AWSToolsAndSDKForNet.msi

and it works as expected. 并且它按预期工作。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM