Receive 400 Bad Request from Image Resizer request in Azure

妖精的绣舞 提交于 2019-12-22 18:26:54

问题


ImageResizer is running as an Azure virtual application (after ImageResizer hotfix). This runs fine in Azure emulation but is having problems in Azure cloud. Image Resizer is working fine if no query string arguments are specified and the url redirects to blob storage, but if a query string argument is specified then I receive a 400 "Bad Request" error.

Below is a screenshot of my browser:

My Azure instance is running Windows Server 2012. I have also disabled the DiskCache plugin to reduce the problem.


回答1:


I got the same problem as You. I used fiddler to see if I could figure out what went wrong and I think I fixed it. It's a problem with AzureReader2 and how it concatenates URL'S.

A specific example from fiddler is this URL: http://xxx.blob.core.windows.net//card-images/14_main_image.png

As you can see it got two slashes in a row which gives you the 400 "bad request".

I downloaded the sourcecode for AzureReader2 and replaced all occurrences of "CloudBlobClient.BaseUri.OriginalString" with "CloudBlobClient.BaseUri.OriginalString.TrimEnd('/', '\')"

I don't know if it's the best fix, but at least it's working until a better fix comes. If you are interested, I can send you the compiled dll.

Best Regards Martin




回答2:


I would have added this as a comment in reply to user2486535, but my StackOverflow rep is not sufficient for posting comments yet...

You are probably getting the 400 Bad Request at this time because the latest version of Microsoft.WindowsAzure.Storage (3.0.2.0) is not compatible with the current Storage Emulator released with the Windows Azure SDK (2.2).

It's explained at the bottom of this article, under "Storage Emulator Guidance": http://blogs.msdn.com/b/windowsazurestorage/archive/2013/11/27/windows-azure-storage-release-introducing-cors-json-minute-metrics-and-more.aspx

As of January 27, Microsoft has released a preview version of the Windows Azure Storage Emulator (2.2.1) that is compatible with Microsoft.WindowsAzure.Storage (3.0.2.0): http://blogs.msdn.com/b/windowsazurestorage/archive/2014/01/27/windows-azure-storage-emulator-2-2-1-preview-release-with-support-for-2013-08-15-version.aspx

Hopefully this helps you get by until the next official release of the Windows Azure SDK.



来源:https://stackoverflow.com/questions/18791817/receive-400-bad-request-from-image-resizer-request-in-azure

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!