带有 azure blob 存储的图像缩放器。 Returns 通过缩放器时出现“403 forbidden”

Image resizer with azure blob storage. Returns "403 forbidden" when going through the resizer

我们在 azurereader2 中使用图像缩放器已经有一段时间了,没有任何问题。在一个小版本发布后(这真的不应该与此有任何关系)当我们尝试通过调整器访问图像时突然出现错误。

这只是我们测试环境中的一个问题,新版本和图像缩放器等在生产环境中运行良好。 生产和测试都托管在 azure 中,并且都使用自己的 azure blob 存储。

示例url: test.mysite.com/images/pim/b6ffa894-bc8f-4f1b-a1e8-ef115b78a56f.jpg?width=250&height=312&format=jpg&scale=both&mode=pad

returns下面的错误

Microsoft.WindowsAzure.Storage.StorageException: The remote server returned an error: (403) Forbidden. ---> System.Net.WebException: The remote server returned an error: (403) Forbidden.
   at Microsoft.WindowsAzure.Storage.Shared.Protocol.HttpResponseParsers.ProcessExpectedStatusCodeNoException[T](HttpStatusCode expectedStatusCode, HttpStatusCode actualStatusCode, T retVal, StorageCommandBase`1 cmd, Exception ex) in c:\Program Files (x86)\Jenkins\workspace\release_dotnet_master\Lib\Common\Shared\Protocol\HttpResponseParsers.Common.cs:line 50
   at Microsoft.WindowsAzure.Storage.Blob.CloudBlobClient.c__DisplayClass13.b__12(RESTCommand`1 cmd, HttpWebResponse resp, Exception ex, OperationContext ctx) in c:\Program Files (x86)\Jenkins\workspace\release_dotnet_master\Lib\ClassLibraryCommon\Blob\CloudBlobClient.cs:line 788
   at Microsoft.WindowsAzure.Storage.Core.Executor.Executor.EndGetResponse[T](IAsyncResult getResponseResult) in c:\Program Files (x86)\Jenkins\workspace\release_dotnet_master\Lib\ClassLibraryCommon\Core\Executor\Executor.cs:line 299
   --- End of inner exception stack trace ---
   at Microsoft.WindowsAzure.Storage.Core.Executor.Executor.EndExecuteAsync[T](IAsyncResult result) in c:\Program Files (x86)\Jenkins\workspace\release_dotnet_master\Lib\ClassLibraryCommon\Core\Executor\Executor.cs:line 50
   at Microsoft.WindowsAzure.Storage.Blob.CloudBlobClient.EndGetBlobReferenceFromServer(IAsyncResult asyncResult) in c:\Program Files (x86)\Jenkins\workspace\release_dotnet_master\Lib\ClassLibraryCommon\Blob\CloudBlobClient.cs:line 630
   at Microsoft.WindowsAzure.Storage.Core.Util.AsyncExtensions.c__DisplayClass1`1.b__0(IAsyncResult ar) in c:\Program Files (x86)\Jenkins\workspace\release_dotnet_master\Lib\ClassLibraryCommon\Core\Util\AsyncExtensions.cs:line 66
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at ImageResizer.Plugins.AzureReader2.AzureReader2Plugin.d__14.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at ImageResizer.Util.AsyncUtils.RunSync[TResult](Func`1 func)
   at ImageResizer.Storage.Blob.Open() in C:\projects\resizer\Plugins\ImageResizer.Storage\Blob.cs:line 41
   at ImageResizer.ImageBuilder.GetStreamFromSource(Object source, ResizeSettings settings, Boolean& disposeStream, String& path, Boolean& restoreStreamPosition)
   at ImageResizer.ImageBuilder.LoadImage(Object source, ResizeSettings settings, Boolean restoreStreamPos)
   at ImageResizer.ImageBuilder.BuildJob(ImageJob job)
   at ImageResizer.ImageBuilder.Build(ImageJob job)
   at ImageResizer.ImageBuilder.Build(Object source, Object dest, ResizeSettings settings, Boolean disposeSource, Boolean addFileExtension)
   at ImageResizer.ImageBuilder.Build(Object source, Object dest, ResizeSettings settings, Boolean disposeSource)
   at ImageResizer.ImageBuilder.Build(Object source, Object dest, ResizeSettings settings)
   at ImageResizer.InterceptModule.c__DisplayClass5_0.b__1(Stream stream)
   at ImageResizer.Plugins.DiskCache.CustomDiskCache.c__DisplayClass28_0.b__0()
   at ImageResizer.Plugins.DiskCache.LockProvider.TryExecute(String key, Int32 timeoutMs, LockCallback success)
   at ImageResizer.Plugins.DiskCache.CustomDiskCache.GetCachedFile(String keyBasis, String extension, ResizeImageDelegate writeCallback, Int32 timeoutMs, Boolean asynchronous)
   at ImageResizer.Plugins.DiskCache.DiskCache.Process(IResponseArgs e)
   at ImageResizer.Plugins.DiskCache.DiskCache.Process(HttpContext context, IResponseArgs e)
   at ImageResizer.InterceptModule.HandleRequest(HttpContext context, HttpModuleRequestAssistant ra, IVirtualFile vf)
   at XXX.Web.Modules.CustomImageResizingInterceptModule.HandleRequest(HttpContext context, HttpModuleRequestAssistant ra, IVirtualFile vf) in E:\TeamCity\buildAgent\work73e55a378b97a1\src\Portal\Portal\Infrastructure\Web\Modules\CustomImageResizingInterceptModule.cs:line 15
   at ImageResizer.InterceptModule.CheckRequest_PostAuthorizeRequest(Object sender, EventArgs e)
   at System.Web.HttpApplication.SyncEventExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()
   at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)
Request Information
RequestID:e8c13071-0001-00c2-437e-d8b9c7000000
RequestDate:Mon, 29 May 2017 13:19:16 GMT
StatusMessage:Server failed to authenticate the request. Make sure the value of Authorization header is formed correctly including the signature.

url test.mysite.com/images/pim/b6ffa894-bc8f-4f1b-a1e8-ef115b78a56f.jpg 正确重定向到 azure blob 中的图像。

我已经尝试重新生成 blob 存储的访问密钥,但没有成功。
我已经尝试从我们的测试环境指向另一个 blob 存储,这也不起作用。

我可以从我的本地环境访问测试 blob 存储。

/resizer.debug 报告检测到 0 个问题。

非常感谢任何帮助,如果我可以提供更多信息,请告诉我。

这纯粹是 azure blob 存储连接问题,图像缩放器不是罪魁祸首。