C#AWS SDK预签名下载URL始终过期

时间:2016-05-04 11:29:23

标签: c# amazon-web-services pre-signed-url

我的Presigned下载网址出现问题

 using (var S3Client = new AmazonS3Client(AppSettings.AwsAccessKey, AppSettings.AwsSecretKey, Amazon.RegionEndpoint.USEast1))
            {
                GetPreSignedUrlRequest request = new GetPreSignedUrlRequest
                {
                    BucketName = AppSettings.AwsS3BucketName,
                    Key = Filename,
                    Expires = DateTime.Now.AddSeconds(ExpirationSeconds),                        
                    Verb = HttpVerb.GET
                };
                return S3Client.GetPreSignedURL(request);
            }

通常我会在10到30秒之前过期,突然之间,我开始收到一条消息,说明我的网址已过期。

<Error>
  <Code>AccessDenied</Code>
  <Message>Request has expired</Message>
  <Expires>2016-05-04T11:21:39Z</Expires>
  <ServerTime>2016-05-04T11:22:12Z</ServerTime>
  <RequestId>F329329970936A18</RequestId>
  <HostId>womi/k5E9ffDDa6PffCcWBMYzUF2i4oRIY+QX6R/6v0IjQlipYA2OKBPQOflkoLIl4+wk6So7Ks=</HostId>
</Error>

日期差异太大。这有什么问题?

1 个答案:

答案 0 :(得分:0)

您的本地计算机时间可能与AWS时间不同。

我有一个类似的问题,我的机器从睡眠模式恢复,并且实时漂移了15分钟。