Azure Storage 403 Forbidden exception a 32-bit iss

2020-08-18 05:44发布

问题:

We've spent quite some time to locate the reason for the following exception:

The remote server returned an error: (403) Forbidden.

Stacktrace:

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.Create(BlobContainerPublicAccessType accessType, BlobRequestOptions requestOptions, OperationContext operationContext) 
   in c:\\Program Files (x86)\\Jenkins\\workspace\\release_dotnet_master\\Lib\\ClassLibraryCommon\\Blob\\CloudBlobContainer.cs:line 68
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 Microsoft.WindowsAzure.Storage.Blob.CloudBlobContainer.CreateIfNotExists(BlobRequestOptions requestOptions, OperationContext operationContext) 
   in c:\\Program Files (x86)\\Jenkins\\workspace\\release_dotnet_master\\Lib\\ClassLibraryCommon\\Blob\\CloudBlobContainer.cs:line 196
...The rest is removed for clearity...

As a last resort we changed the App-service environment setting from 32-bit (seems to be default) to 64-bit and the problem was solved. No more forbidden exceptions.

We still don't know why 32-bit should cause the exception. Does anybody know why? Would be nice to know.

Update

Assemblies in our solution are compiled as .NET 4.6.1/Any CPU

Some of the theories we have

  • Nuget/Azure incompatibilities (versioning)
  • JIT-compiler 32-bit/64-bit differences
  • Timing issues with 32-bit (authentication and server-clock)
  • Other...