C# 在AmazonS3.NETSDK中,您尝试访问的bucket必须使用指定的端点进行寻址

C# 在AmazonS3.NETSDK中,您尝试访问的bucket必须使用指定的端点进行寻址,c#,windows-phone-8,amazon-s3,C#,Windows Phone 8,Amazon S3,我正在widows phone 8应用程序中使用amazon.NET SDK上传图像,代码运行正常。现在我遇到一个异常 必须使用 指定的终结点。请将所有未来请求发送到此终结点 我已经更新到SDK 2.0.2.2的最新版本,更新后有什么变化吗 我的代码 string awsID = "myid"; string secretKey = "mysecretkey"; try{ AmazonS3Client s3Client = new AmazonS3Client(awsID,

我正在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);
    }

发生这种情况是因为bucket region不正确。 在Amazon控制台S3 bucket上检查您的区域,并在配置文件和代码中配置相同的区域

例如:

AmazonS3Client s3Client = new AmazonS3Client(awsID, secretKey, RegionEndpoint.APNortheast1);

<add key="AWSRegion" value="eu-west-1" />
AmazonS3Client s3Client=新的AmazonS3Client(awsID、secretKey、RegionEndpoint.APNortheast1);

TargetInvocationException设置为什么?@JoachimIsaksson我已经用异常详细信息更新了我的问题。您是否在传递的
AmazonS3Config
上设置了
ServiceURL
?否则,您目前是如何配置的?@JoachimIsaksson我已经添加了我的代码,没有,我没有通过amazons3config,代码几天前确实有效。@WadeMatveyenko我在这里遇到了一个奇怪的问题,当我将其更改为us-east-1时,它工作正常。..Bt我只在us-west-1中有它。。从图像的URL中可以明显看出。。有什么线索吗?