问题
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