2
我使用直接從亞馬遜的.NET API上傳一些文件到S3。如何使用.NET API爲AWS S3上傳生成我的請求籤名?
但是,我得到異常消息:The request signature we calculated does not match the signature you provided. Check your key and signing method.
我的代碼如下:
AmazonS3 s3Client = AWSClientFactory.CreateAmazonS3Client("myaccessid","mysecretid");
List<string> allFileNames = ProcessFiles(@"c:\Dev\pktest\");
foreach (string file in allFileNames)
{
PutObjectRequest putObjectRequest = new PutObjectRequest
{
BucketName = "rhspktest",
FilePath = file,
Key = file,
Timeout = 3600000
};
try
{
using (S3Response response = s3Client.PutObject(putObjectRequest)) { };
}
catch (AmazonS3Exception ex)
{
Console.WriteLine(ex.Message);
}
Console.WriteLine(file);
}
Console.Read();
有什麼立竿見影我做錯了嗎?
ProcessFiles方法只是返回該目錄中的文件名列表。
是的,你是對的。我認爲這是造成這個問題的反斜槓。 – 2011-04-03 11:00:23