代码之家  ›  专栏  ›  技术社区  ›  Bokambo

签名与S3不匹配

  •  0
  • Bokambo  · 技术社区  · 6 年前

    我正在犯错误-

    我们计算的请求签名与您提供的签名不匹配。检查您的秘密访问密钥和签名方法。有关详细信息,请参阅REST身份验证和SOAP身份验证。”

    远程服务器返回错误:(403)禁止。

    我查过我的密匙了里面没有空格。

    我的钥匙看起来像-

    TestArea/Destination/SUP000011/ATM-1B4L2KQ0ZE0-0001/SoS_Update_2018_06_04_pram.pptx
    

    密码-

     public static Stream GetObjectStream(string keyName)
            {
                GetObjectRequest request = new GetObjectRequest
                {
                    BucketName = bucketName,
                    Key = keyName
                };
    
                    using (AmazonS3Client StorageClient = GetClient())
    //This line gives error (getting response)
                    using (GetObjectResponse response = StorageClient.GetObject(request))
                using (Stream responseStream = response.ResponseStream)
                {
                    return responseStream;
                }
            }
    
    public static Amazon.S3.AmazonS3Client GetClient()
            {
                AmazonS3Config Config = new AmazonS3Config();
                AmazonS3Client StorageClient;
    
                Config.RegionEndpoint = null;
                Config.ServiceURL = ConfigurationManager.NGDMSobjECSEndPoint;
                Config.AllowAutoRedirect = true;
                Config.ForcePathStyle = true;
    
                StorageClient = new AmazonS3Client(ConfigurationManager.NGDMSobjECSUser, ConfigurationManager.NGDMSobjECSKey, Config);
    
                return StorageClient;
            }
    
    1 回复  |  直到 6 年前
        1
  •  0
  •   Bokambo    6 年前

    我的密钥出现了问题,我创建了一个新的密钥,它成功了。