Azure Storage Emulator 403 Forbidden

Through Nuget, I updated WindowsAzure.Storage to 8.1.1 .

Then I downloaded the AzureStorageEmulator 5.1.0.0 client.

My connection string:

 UseDevelopmentStorage=true; 

I have not made any code changes since it worked fine. I know that I am getting an 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 could affect 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 see this error after updating the client and nuget package?

Edit: GetClient () Code:

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

Edit: BaseUri

Base URI: http://127.0.0.1:10000/devstoreaccount1

Visit this:

 <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 emulation of the storage emulator, it shows that he set it to:
(localdb)\MSSQLLocalDB as AzureStorageEmulatorDb51

Visit: http://127.0.0.1:10000/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> 
+5
source share
6 answers

I had the same problem and I also tried downgrading WindowsAzure.Storage without success. After a long day of trying to disable everything, I found that removing this line from startup.cs fixes the problem:

services.AddApplicationInsightsTelemetry(configuration);

I don’t know why this is related and why ApplicationInsights causes problems for Azure storage. I tried using both version 2.1.0-beta2 and 2.0.0 from Microsoft.ApplicationInsights.AspNetCore, and both of them cause a 403 error.

+9
source

You can solve this problem for Application Insights version 2.4.0 by modifying the ApplicationInsights.config file and adding localhost to the ExcludeComponentCorrelationHttpHeadersOnDomains section, thus:

 <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> 
+3
source

Updating application information from version 2.4 to 2.4.1 solved this problem.

Note: when I decided to add AI to my project (using the wizard), version 2.4 was added. Surprisingly, the added version was not the latest version of AI. I needed to go to NuGet and manually upgrade to the latest version.

+2
source

I had the same problem, could not find a solution to fix this. This seems to be related to ApplicationInsights - a direct call to the local emulator from a clean console application works fine, calling the emulator from a web project with ApplicationInsights returns 403.

You can use another storage emulator or use real Azure Blob storage.

0
source

We had the same problem after installing Application Insights in our business rule project. We have an N-tier solution with the asp.net core that has a different version of the applications.

It turns out that we installed the main non asp.net package in the business rule, which then caused a Forbidden 403 error when accessing the Queue Client.

We removed the basic information about applications other than asp.net, installed the application kernel in the business rule project, and everything worked fine.

0
source

For those who do not see

services.AddApplicationInsightsTelemetry(configuration);

in the Startup.cs file, ApplicationInsight configuration can be done in Program.cs , for example:

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

Source: https://habr.com/ru/post/1267234/


All Articles