我已经创建了 azure 存储帐户。我已经创建了文件存储。我已经生成了 SAS 令牌。当我尝试使用 sas 令牌访问文件时显示错误“远程服务器返回错误:(403)禁止。”
我能够生成 SAS 令牌。当我尝试访问文件存储中的文件时抛出异常。我试图在浏览器上复制和粘贴 url 时抛出错误“
<Error>
<Code>AuthorizationResourceTypeMismatch</Code>
<Message>
This request is not authorized to perform this operation using
this resource type. RequestId:4cbc0cbe-401a-00c2-2edf-
202bc4000000 Time:2019-06-12T05:26:39.4816687Z
</Message>
</Error>"
我用来生成 SAS 令牌的代码
静态字符串 GetAccountSASToken()
SharedAccessAccountPolicy policy = new
SharedAccessAccountPolicy()
{
Permissions = SharedAccessAccountPermissions.Read |
SharedAccessAccountPermissions.Write |
SharedAccessAccountPermissions.List,
Services = SharedAccessAccountServices.File,
ResourceTypes = SharedAccessAccountResourceTypes.Service,
SharedAccessExpiryTime = DateTime.UtcNow.AddHours(24),
Protocols = SharedAccessProtocol.HttpsOnly,
};
我用来访问文件的代码
XDocument objdoc = XDocument.Load(filepath+ sasToken);
将文件加载到 XDocument 后,我必须执行一些读写操作。请帮助找出我正在做的错误