Claudio
Claudio

Reputation: 23

ImageResizer.AzureReader2 not working with QUERYSTRING (Azure Web App)

I'm trying to migrate to Azure, a ASP.NET app that has been successfully running ImageResizer. I loaded my ~/Photos files onto blockblobs, and installed the AzureReader2 plugin.

Then an error prevents the application from loading:

Unable to load Microsoft.WindowsAzure.CloudConfigurationManager from assembly  
Microsoft.WindowsAzure.Configuration, Version=3.0.0.0, Culture=neutral,
PublicKeyToken=31bf3856ad364e35.

I downloaded the AzureReader2 source code and recompiled it replacing the missing CloudConfigurationManager() with CloudStorageAccount.Parse(), which seemed to fix the problem.

I replaced the reference to the 3.4.3 AzureReader2 plugin with the modified plugin and the application runs.

Now AzureReader2 seems to intercept image requests and redirect to the specified endpoint, AS LONG as no QUERYSTRING is specified.

If I specify any querystring parameters, I get the 404-Not Found.

http://localhost:1905/Photos/2025/15/29/qcu0tks1.jpg?width=100

If I omit the querystring, it redirects to the Azure storage url and displays the image: http://127.0.0.1:10000/devstoreaccount1/pracasar/Photos/2025/15/29/qcu0tks1.jpg

If I apply querystring parameters to a different folder (say ~/images/logo.jpg), it works just fine. So this really seems to be an issue with AzureReader2.

Any ideas?

Upvotes: 1

Views: 365

Answers (1)

Claudio
Claudio

Reputation: 23

As for the 404-Not Found error, the problem was how the container name was specified.

I was adding the container name to the endpoint. That led to the erratic behavior described (404-Not Found when specifying a querystring).

**Generates: 404-Not Found when querystring is specified**
<add name="AzureReader2"
       endpoint="http://mystorage.blob.core.windows.net/mycontainer" prefix="~/Photos" /> 

Although the resulting URL works, when the querystring is specified, it generates 404-Not Found.

Container name should added as a prefix to the resource name.

Upvotes: 1

Related Questions