Ted Nyberg
Ted Nyberg

Reputation: 7391

ImageResizer with AzureReader2 returns 404 for all requests

I'm having a hard time getting the AzureReader2 plugin for ImageResizer to work. Basically, all requests yield 404's.

Here is a summary of the situation:

Requesting the blob directly works fine, with a URL like:

http://ACCOUNTNAME.blob.core.windows.net/media/1004/some-image.jpg

However, the following URL does not work:

http://localhost/azure/media/1004/some-image.jpg

Appending a query string with ImageResizer commands yields the same result.

Here is the config:

<resizer>
   <diagnostics enableFor="Localhost" />
   <plugins>
     <add name="MvcRoutingShim" />
     <add name="AzureReader2" prefix="~/azure/" endpoint="http://ACCOUNTNAME.blob.core.windows.net/" connectionString="DefaultEndpointsProtocol=http;AccountName=ACCOUNTNAME;AccountKey=ACCOUNTKEY" />
     <add name="DiskCache" />
   </plugins>
   <diskcache dir="~/App_Data/imageresizer" />
</resizer>

I'm a bit lost, any help is greatly appreciated! Thanks!

Edit: As per Nathanael's suggestion I built ImageResizer 4 with Newtonsoft 6, and placed the following assemblies in the bin folder:

I also removed the "MvcRoutingShim" plugin from config, as it is installed by default.

Now everything works as expected with ImageResizer 4 on an Umbraco 7 site!

Upvotes: 0

Views: 120

Answers (1)

Lilith River
Lilith River

Reputation: 16468

My first suggestion would be to use an assembly binding redirect on Newtonsoft.Json so that you can upgrade to ImageResizer 4. Azure makes breaking changes to their APIs frequently, and ImageResizer 3 no longer tracks those changes.

ImageResizer 4 can also work with an older version of Newtonsoft if you are comfortable downloading and rebuilding ImageResizer from source.

Older versions of ImageResizer also (incorrectly) return a 404 for any FileNotFoundException... which can occur if assemblies (like the azure SDK) are missing.

Precompilation will also break azurereader2..

Related: Resizing an image using AzureReader2 results in 404

AzureReader2 not working with querystring

If none of the above suggestions work, I would suggest stepping through the source with a debugger to discover why image providers do not work. First upgrade to v4 if at all possible.

Upvotes: 2

Related Questions