【发布时间】:2013-11-22 05:41:18
【问题描述】:
我在 widows phone 8 应用程序中使用 amazon .NET SDK 来上传图片,代码运行良好。现在出现异常
您尝试访问的存储桶必须使用 指定的端点。请将所有未来的请求发送到此端点。
我已经更新到最新版本的 SDK 2.0.2.2,更新后有什么变化吗?
我的代码
string awsID = "myid";
string secretKey = "mysecretkey";
try{
AmazonS3Client s3Client = new AmazonS3Client(awsID, secretKey,RegionEndpoint.USWest1);
string s="";
if (IsolatedStorageSettings.ApplicationSettings.Contains("selectedphoto1"))
{
s = IsolatedStorageSettings.ApplicationSettings["selectedphoto1"] as string;
}
var InputStream = App.GetResourceStream(new Uri("appname;component/Assets /call.png", UriKind.Relative));
var request = new PutObjectRequest()
{
BucketName = "mybucketname",
ContentType="image/png",
Key=s+".jpg",
InputStream = myFileStream,
};
await s3Client.PutObjectAsync(request);
}
catch (Exception ex)
{
Console.Write(ex.InnerException);
}
【问题讨论】:
-
TargetInvocationException 的内部异常设置为什么?
-
@JoachimIsaksson 我已经用异常详细信息更新了我的问题。
-
您是否在您传入的
AmazonS3Config上设置了ServiceURL?否则,您目前如何配置它? -
@JoachimIsaksson 我已经添加了我的代码,不,我没有通过 amazons3config,并且代码在几天前确实有效..
-
@WadeMatveyenko 我在这里遇到一个奇怪的问题,当我将其更改为 us-east-1 时,它工作正常..Bt 我只在 us-west-1 中拥有它.. 从 URL 中可以明显看出图片的..有什么线索吗?
标签: c# windows-phone-8 amazon-s3