AzureReader2 not working with querystring

有些话、适合烂在心里 提交于 2019-12-13 05:39:16

问题


I have images in private blockblobs in Azure.

I am using Azure Reader 2 and can access the image like this http://localhost:55328/azure/00001/IMG_0001.JPG - it works fine and redirects to the blob with a Shared Access Signature.

However, if I try to resize the image, e.g. IMG_0001.JPG?width=100&height=100, I just get a 404.

Stepping through the code, I notice this line

if (e.VirtualPath.StartsWith(prefix, StringComparison.OrdinalIgnoreCase) && e.QueryString.Count == 0)
        {
         ....
        }

So, if there's a QueryString, no processing happens.

Debug output here: https://gist.github.com/anonymous/28fd112eec194181baae

Thanks in advance


回答1:


Your debugging misled you. It's true that redirection only happens when there is no querystring. When there are parameters, the blob needs to be modified, which means we must proxy it. A 302 redirect in that scenario is impossible.

AzureReader registers a IVirtualImageProvider, which ImageResizer automatically uses when handling all the proxying, processing, and caching.

The default behavior is to download, modify, and re-serve the data. The 302 redirect is just an optimization for throughput on unmodified files.

Notes:

sharedAccessExpiryTime is ignored, there is no setting by that name.

If you are going to reference code, it's best to link to the line in the file on github, otherwise we can't easily find the context. Press y on any github page to get a permalink, then click a line number (or range).



来源:https://stackoverflow.com/questions/28590779/azurereader2-not-working-with-querystring

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