我正在尝试通过下面的代码为容器生成共享访问 key
string sas = azureContainer.GetSharedAccessSignature (new SharedAccessPolicy ()
{
SharedAccessStartTime = DateTime.UtcNow,
SharedAccessExpiryTime = DateTime.UtcNow.AddHours(1),
Permissions = SharedAccessPermissions.Write | SharedAccessPermissions.Read
});
共享访问签名在这种情况下工作正常。客户端成功将文件上传到容器上。但是,如果我设置的时间超过 1 小时(例如 2),我在尝试在客户端上传文件时会遇到异常
Server failed to authenticate the request. Make sure the value of Authorization header is formed correctly including the signature.
类似地,如果我尝试设置它 DateTime.UtcNow.AddMinutes(61)
我会得到相同的异常。任何小于或等于 60 分钟的时间都可以。
我的问题:共享访问签名的最长时间是否为 60 分钟?我在任何文档中都没有找到任何这样的东西。
最佳答案
正如我在 this answer 中指出的那样:从 2012 年 Spring 版本开始,取消了 1 小时的限制。 MSDN 文章是 here 。目前,您需要从 github here 自行提取并构建 v1.7.1 库(假设您使用的是 .net)。 ,因为它尚未作为最新 SDK+工具的一部分发布。该版本的库将使用2012-02-12协议(protocol)版本。
关于c# - SharedAccessExpiryTime 的最大限制是 60 分钟吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12268320/