简体   繁体   English

Azure存储 - 403禁止

[英]Azure Storage - 403 Forbidden

I am getting 403 forbidden error message while connecting to azure storage from application server. 从应用程序服务器连接到azure存储时,我收到403禁用错误消息。 I am using below code snippet to check connectivity with azure storage. 我使用下面的代码片段来检查与azure存储的连接。

I am not sure it could be our firewall/proxy not allowing connectivity or related to SSL certificate (cert revocation). 我不确定它可能是我们的防火墙/代理不允许连接或与SSL证书(证书撤销)相关。 I am checking with our network team on this; 我正在检查我们的网络团队; any suggestion would be helpful. 任何建议都会有所帮助。

  string storageConnString = "DefaultEndpointsProtocol=https;AccountName=azstoragel692;AccountKey=asdfas234234sdfsdf234234;EndpointSuffix=core.windows.net";   
        var storageAccount = CloudStorageAccount.Parse(storageConnString);
        var blobStorage = storageAccount.CreateCloudBlobClient();
        CloudBlobContainer container = blobStorage.GetContainerReference("myContainer");
        var blobsCount = container.ListBlobs().Count();
        Console.WriteLine(blobsCount);

Exception: 例外:

Microsoft.WindowsAzure.Storage.StorageException: The remote server returned an e rror: (403) Forbidden. Microsoft.WindowsAzure.Storage.StorageException:远程服务器返回了一个错误:(403)Forbidden。 ---> System.Net.WebException: The remote server returned an error: (403) Forbidden. ---> System.Net.WebException:远程服务器返回错误:(403)Forbidden。

at System.Net.HttpWebRequest.GetResponse() at Microsoft.WindowsAzure.Storage.Core.Executor.Executor.ExecuteSync[T](RESTC ommand`1 cmd, IRetryPolicy policy, OperationContext operationContext) in c:\\Prog ram Files (x86)\\Jenkins\\workspace\\release_dotnet_master\\Lib\\ClassLibraryCommon\\C ore\\Executor\\Executor.cs:line 677 在System.Net.HttpWebRequest.GetResponse()中的Microsoft.WindowsAzure.Storage.Core.Executor.Executor.ExecuteSync [T](RESTC ommand`1 cmd,IRetryPolicy策略,OperationContext operationContext)中的c:\\ Prog ram文件(x86) \\ Jenkins \\ workspace \\ release_dotnet_master \\ Lib \\ ClassLibraryCommon \\ C ore \\ Executor \\ Executor.cs:第677行

Request Information RequestID: RequestDate:Fri, 01 Dec 2017 14:04:26 GMT StatusMessage:AccessDenied 请求信息RequestID:RequestDate:Fri,01 Dec 2017 14:04:26 GMT StatusMessage:AccessDenied

I know this is the answer for your case but it may be the answer for someone else. 我知道这是你的案件的答案,但它可能是其他人的答案。

In my case, I was getting 403 Forbidden because the server was somehow set to an hour before. 在我的情况下,我得到403 Forbidden因为服务器以某种方式设置为一小时。

This was followed by an issue with the data center. 接下来是数据中心的问题。 I can't be sure if this was the cause but the fact is that after I synced the time correctly, it started working just fine. 我不能确定这是否是原因,但事实是,在我正确地同步时间后,它开始工作得很好。

I got this tip (request timestamp too old) after installing Microsoft Azure Storage Explorer in the server and trying to access the blob storage. 在服务器中安装Microsoft Azure Storage Explorer并尝试访问blob存储后,我得到了这个提示(请求时间戳太旧)。

Finally I was able to resolve this issue. 最后我能够解决这个问题。 It was with our enterprise proxy which was blocking the connection to Azure storage account. 我们的企业代理阻止了与Azure存储帐户的连接。 As I was trying to connect Azure blob storage so we had to whitelist URL *.blob.core.windows.net on the proxy. 当我尝试连接Azure blob存储时,我们不得不在代理上将 URL * .blob.core.windows.net列入白名单。

Please check the clock on the servers in question. 请检查有问题的服务器上的时钟。 Apart from the incorrect account key, you can also get 403 error if the time on the server is not in sync with the time on storage servers (Give or take +/- 15 minutes deviation is allowed). 除了错误的帐户密钥,如果服务器上的时间与存储服务器上的时间不同,您还可能会收到403错误(允许或允许+/- 15分钟的偏差)。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Azure 存储帐户 - 禁止错误 403 - Azure Storage Account - error 403 forbidden azure存储模拟器(表)返回400个错误请求或403禁止 - azure storage emulator (Table) returns 400 bad request or 403 forbidden Azure BLOB 存储 REST API 上传文件抛出 403 - 禁止访问 - Azure BLOB Storage REST API Uploading a file throws 403 - Forbidden Azure 存储 CloudTable 使用只读 SAS 密钥返回 403 Forbidden - Azure Storage CloudTable Using read-only SAS key returns 403 Forbidden 尝试将特定图像上传到 Azure 存储帐户时出现 403 Forbidden - Microsoft-Azure-Application-Gateway/v2 - Getting 403 Forbidden - Microsoft-Azure-Application-Gateway/v2 when trying to upload particular image to the Azure storage account 了解Azure CloudTableClient:禁止(403)异常 - Understanding Azure CloudTableClient: Forbidden(403) Exception 对Azure订阅日志使用证书-禁止使用403 - Using a certificate for Azure subscription logs - 403 forbidden 403禁止使用Azure Graph API - 403 Forbidden from Azure Graph API Azure CloudBlobContainer.CreateIfNotExists 返回 403 forbidden - Azure CloudBlobContainer.CreateIfNotExists returns 403 forbidden Azure 存储:403 服务器无法对请求进行身份验证 - Azure Storage: 403 Server failed to authenticate the request
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM