简体   繁体   English

Azure存储模拟器403禁止使用

[英]Azure Storage Emulator 403 Forbidden

Via Nuget, I upgraded WindowsAzure.Storage to 8.1.1 . 通过Nuget,我将WindowsAzure.Storage升级到8.1.1

I then downloaded the AzureStorageEmulator 5.1.0.0 client. 然后我下载了AzureStorageEmulator 5.1.0.0客户端。

My connection string: 我的连接字符串:

UseDevelopmentStorage=true;

I've made no code changes since previously when it was apparently working fine. 我之前没有进行任何代码更改,因为它显然工作正常。 I know get the exception: 我知道得到例外:

Microsoft.WindowsAzure.Storage.StorageException: The remote server returned an error: (403) Forbidden. ---> System.Net.WebException: The remote server returned an error: (403) Forbidden.
   at System.Net.HttpWebRequest.GetResponse()
   at Microsoft.WindowsAzure.Storage.Core.Executor.Executor.ExecuteSync[T](RESTCommand`1 cmd, IRetryPolicy policy, OperationContext operationContext) in c:\Program Files (x86)\Jenkins\workspace\release_dotnet_master\Lib\ClassLibraryCommon\Core\Executor\Executor.cs:line 677
   --- End of inner exception stack trace ---
   at Microsoft.WindowsAzure.Storage.Core.Executor.Executor.ExecuteSync[T](RESTCommand`1 cmd, IRetryPolicy policy, OperationContext operationContext) in c:\Program Files (x86)\Jenkins\workspace\release_dotnet_master\Lib\ClassLibraryCommon\Core\Executor\Executor.cs:line 604
   at Microsoft.WindowsAzure.Storage.Blob.CloudBlobContainer.CreateIfNotExists(BlobContainerPublicAccessType accessType, BlobRequestOptions requestOptions, OperationContext operationContext) in c:\Program Files (x86)\Jenkins\workspace\release_dotnet_master\Lib\ClassLibraryCommon\Blob\CloudBlobContainer.cs:line 233
   at C3.Code.Controls.Application.Storage.Blob.Blob.GetContainer(String containerName) in C:\Dropbox\Dropbox (Scirra Ltd)\Tom\C3 Website\C3Alpha2\Code\Controls\Application\Storage\Blob\Blob.cs:line 112
Request Information
RequestID:621bc19f-eb6a-4a98-b19e-f5b01ac22c26
RequestDate:Thu, 27 Apr 2017 16:17:34 GMT
StatusMessage:Server failed to authenticate the request. Make sure the value of Authorization header is formed correctly including the signature.
ErrorCode:AuthenticationFailed
ErrorMessage:Server failed to authenticate the request. Make sure the value of Authorization header is formed correctly including the signature.
RequestId:621bc19f-eb6a-4a98-b19e-f5b01ac22c26
Time:2017-04-27T16:17:34.5166522Z

When I call 我打电话的时候

var blobClient = GetClient();
var container = blobClient.GetContainerReference(containerName);
container.CreateIfNotExists(BlobContainerPublicAccessType.Blob);

I saw that system time can impact this, so I checked: 我看到系统时间会影响这个,所以我查了一下:

Server DateTime.UtcNow = 27/04/2017 16:17:34
Exception RequestDate = Thu, 27 Apr 2017 16:17:34 GMT

Any ideas why I'm seeing this error after updating the client and the nuget package? 任何想法为什么我在更新客户端和nuget包后看到这个错误?

Edit: GetClient() Code: 编辑:GetClient()代码:

private static CloudBlobClient GetClient()
{
    var account = CloudStorageAccount.Parse(Settings.Deployment.AzureConnectionString);
    return account.CreateCloudBlobClient();
}

Edit: BaseUri 编辑:BaseUri

Base URI is: http://127.0.0.1:10000/devstoreaccount1 基本URI是: http//127.0.0.110000 / devstoreaccount1

Visit this I get: 访问我得到:

<Error>
<Code>InvalidQueryParameterValue</Code>
<Message>
Value for one of the query parameters specified in the request URI is invalid. RequestId:9cc906b0-eec6-44b2-bb3d-f77020af4a4c Time:2017-04-27T16:43:16.8538679Z
</Message>
<QueryParameterName>comp</QueryParameterName>
<QueryParameterValue/>
<Reason/>
</Error>

During storage emulator init, it shows it's installed it to: 在存储模拟器初始化期间,它显示它已安装到:
(localdb)\\MSSQLLocalDB as AzureStorageEmulatorDb51 (localdb)\\MSSQLLocalDB as AzureStorageEmulatorDb51

Visiting: http://127.0.0.1:10000/azurestorageemulatordb51 访问: http//127.0.0.110000 / azurestorageemulatordb51

Shows: 显示:

<Error>
<Code>OutOfRangeInput</Code>
<Message>
One of the request inputs is out of range. RequestId:dab5e6c1-bc4a-4c65-a4d9-6d44634cb36a Time:2017-04-27T16:47:20.3093597Z
</Message>
</Error>

I had the same problem and also tried downgrading WindowsAzure.Storage without success. 我遇到了同样的问题,并尝试降级WindowsAzure.Storage但没有成功。 After a long day of trying to disable everyting I discovered that removing this line from startup.cs fixed the problem: 经过漫长的一天尝试禁用每一个,我发现从startup.cs中删除此行修复了问题:

services.AddApplicationInsightsTelemetry(configuration);

I don't know why these are related and why ApplicationInsights causes problems for Azure storage. 我不知道为什么这些是相关的,以及为什么ApplicationInsights会导致Azure存储出现问题。 I have tried using both version 2.1.0-beta2 and 2.0.0 of Microsoft.ApplicationInsights.AspNetCore and both cause the 403 error. 我尝试使用版本2.1.0-beta2和2.0.0的Microsoft.ApplicationInsights.AspNetCore,都导致403错误。

You can resolve this issue for Application Insights version 2.4.0 by modifying the ApplicationInsights.config file and adding the localhost in to the ExcludeComponentCorrelationHttpHeadersOnDomains section thus: 您可以通过修改ApplicationInsights.config文件并将localhost添加到ExcludeComponentCorrelationHttpHeadersOnDomains部分来解决Application Insights版本2.4.0的此问题:

<ExcludeComponentCorrelationHttpHeadersOnDomains>
    <Add>localhost</Add>
    <Add>127.0.0.1</Add>
    <Add>core.windows.net</Add>
    <Add>core.chinacloudapi.cn</Add>
    <Add>core.cloudapi.de</Add>
    <Add>core.usgovcloudapi.net</Add>
</ExcludeComponentCorrelationHttpHeadersOnDomains>

Upgrading Application Insights from version 2.4 to 2.4.1 solved this issue. 从2.4版升级到2.4.1的Application Insights解决了这个问题。

Note: when I chose to add AI to my project (using wizard), version 2.4 was added. 注意:当我选择将AI添加到我的项目中时(使用向导),添加了版本2.4。 Surprisingly, the version added was not the latest AI version. 令人惊讶的是,添加的版本不是最新的AI版本。 I had to go to NuGet and to manually upgrade to latest version. 我不得不去NuGet并手动升级到最新版本。

I've had the same problem, could not find any solution to fix that. 我遇到了同样的问题,找不到任何解决办法来解决这个问题。 It really seems to be connected to ApplicationInsights - direct call to the local emulator from a clean console application works fine, calling the emulator from a web project with ApplicationInsights returns 403. 它似乎真的连接到ApplicationInsights - 从干净的控制台应用程序直接调用本地模拟器工作正常,从ApplicationInsights返回403的Web项目调用模拟器。

You can use another storage emulator or use a real Azure Blob Storage. 您可以使用其他存储模拟器或使用真正的Azure Blob存储。

We had the same issue after installing the Application Insights package into our business rules project. 将Application Insights包安装到业务规则项目后,我们遇到了同样的问题。 We have an N-tier solution with asp.net core, which has a different version of application insights. 我们有一个带有asp.net核心的N层解决方案,它具有不同版本的应用程序洞察。

It turns out we installed the non asp.net core package into the business rules, which then produced the Forbidden 403 error when accessing Queue Client. 事实证明,我们将非asp.net核心软件包安装到业务规则中,然后在访问Queue Client时产生Forbidden 403错误。

We removed the non asp.net core application insights, installed the application insights core into the business rules project and all worked ok. 我们删除了非asp.net核心应用程序洞察,将应用程序洞察核心安装到业务规则项目中,并且一切正常。

For those who don't see 对于那些没有看到的人

services.AddApplicationInsightsTelemetry(configuration);

in their Startup.cs file, the ApplicationInsight configuration might be done in Program.cs , like so: 在他们的Startup.cs文件中,ApplicationInsight配置可能在Program.cs完成,如下所示:

var host = new WebHostBuilder()
    .UseKestrel()
    .UseContentRoot(Directory.GetCurrentDirectory())
    .UseIISIntegration()
    .UseStartup<Startup>()
    .UseApplicationInsights() /* HERE */
    .Build();

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

相关问题 Azure存储模拟器 - blob创建提供403 Forbidden消息 - Azure storage emulator - blob creation gives 403 Forbidden message Azure Blob存储上载错误:(403)禁止 - Azure Blob Storage Upload Error: (403) Forbidden Azure 存储帐户 - 禁止错误 403 - Azure Storage Account - error 403 forbidden 带有Microsoft.WindowsAzure.Storage.StorageException的Azure WebJobs FunctionIndexingException禁止403 - Azure WebJobs FunctionIndexingException with Microsoft.WindowsAzure.Storage.StorageException 403 Forbidden 通过SAS访问Azure Blob存储时禁止使用零散403 - Sporadic 403 forbidden when accessing Azure blob storage through SAS 无法访问 Pulumi 创建的 Azure 存储表 - 禁止访问 (403) - Unable to access a Pulumi Created Azure Storage Table - Access Forbidden (403) Azure DevOps 管道 Azure Blob 存储上传文件 403 禁止异常 - Azure DevOps Pipeline Azure Blob Storage upload file 403 Forbidden Exception 尝试从Azure网站创建Azure存储表时禁止出现错误403 - Error 403 Forbidden when trying to create an Azure Storage Table from Azure Websites 天蓝色存储禁止使用204 - 204 forbidden on azure storage Azure CDN 返回 403 禁止 - Azure CDN returns 403 forbidden
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM