【发布时间】:2017-02-03 19:31:17
【问题描述】:
下面是代码,我用来插入到表存储中。
string SAS = "SAS Token from the portal";
StorageCredentials storagecred = new StorageCredentials(SAS);
var ctc = new CloudTableClient(
new StorageUri(new Uri(
"https://{myaccountname}.table.core.windows.net")),storagecred);
var table = ctc.GetTableReference("{tablename}");
table.CreateIfNotExists();
我收到禁止访问表错误 (403)。我是否传递了任何不正确的参数?我的理解是,生成 SAS 后,不需要帐户凭据。提供的 IP 地址是我的私有 IP。
【问题讨论】:
-
看看
StorageException,尤其是RequestInformation。您应该找到有关此 403 错误的更多详细信息。 -
@GauravMantri 在
RequestInformation中我收到一条消息 - 服务器无法验证请求。确保 Authorization 标头的值格式正确,包括签名。 -
你不能把私有IP地址放在那里。你必须使用你的公共IP地址。 Azure 看不到你的私有 IP 地址。
-
@juunas 谢谢!问题在于 IP 地址,当我使用公共地址时,它起作用了。