0

I'm using the ImageResizer library in my ASP.NET MVC website. I tried to turn on view precompilation to speed up first page load time and the image resizer stopped working. I get the following 404 message when trying to access a resized image:

The resource you are looking for has been removed, had its name changed, or is temporarily unavailable.

In the debug output (shown below) from ImageResizer it says "(Warning): Precompilation is enabled. Image providers may not work as expected."

Is there any way to get them working together?

The troubleshooting guide says a file not found error could be because "You (a) aren't specifying a command string, (b) have Precompilation enabled, and (c) are using an image provider. This is caused by a long-standing bug in the .NET framework." What is a command string? If I specify a command string will it work? If so, how do I do that?

Debug Output:

Image resizer diagnostic sheet      3/2/2017 3:31:20 PM

2 Issues detected:

(Warning):  To potentially see additional errors here, perform an image resize request.


(Warning):  Precompilation is enabled. Image providers may not work as expected.



You are using plugins from the Performance Edition: DiskCache (Performance Edition), AzureReader2Plugin (Performance Edition)

Registered plugins:

ImageResizer.Plugins.Basic.DefaultEncoder
ImageResizer.Plugins.Basic.NoCache
ImageResizer.Plugins.Basic.ClientCache
ImageResizer.Plugins.Basic.Diagnostic
ImageResizer.Plugins.Basic.SizeLimiting
ImageResizer.Plugins.MvcRoutingShim.MvcRoutingShimPlugin
ImageResizer.Plugins.DiskCache.DiskCache
ImageResizer.Plugins.AzureReader2.AzureReader2Plugin

Configuration:

<resizer>
<clientcache minutes="1440" />
<sizelimits imageWidth="0" imageHeight="0" totalWidth="3200" totalHeight="5000" totalBehavior="throwexception" />
<diagnostics enableFor="allhosts" />
<plugins>
<add name="MvcRoutingShim" />
<add name="DiskCache" />
<add name="AzureReader2" connectionString="[redacted]" endpoint="[redacted]" lazyExistenceChceck="True" prefix="~/assets/" />
</plugins>
</resizer>


Accepted querystring keys:

quality, format, thumbnail, maxwidth, maxheight, width, height, w, h, scale, stretch, crop, cropxunits, cropyunits, page, bgcolor, rotate, flip, sourceFlip, sFlip, sRotate, borderWidth, borderColor, paddingWidth, paddingColor, ignoreicc, frame, useresizingpipeline, cache, process, margin, anchor, dpi, mode, zoom, 

Accepted file extensions:

bmp, gif, exif, png, tif, tiff, tff, jpg, jpeg, jpe, jif, jfif, jfi, 

Environment information:

Running Microsoft-IIS/8.0 on Microsoft Windows NT 6.2.9200.0 and CLR 4.0.30319.42000
Trust level: Unrestricted
OS bitness: x86 !! Warning, running as 32-bit on a 64-bit OS(AMD64). This will limit ram usage !!
Executing assembly: D:\Windows\SysWOW64\inetsrv\w3wp.exe
IntegratedPipeline: True

...
...

1 Answer 1

0

Pre-compilation breaks all VirtualPathProviders. We've done various mitigations, but you cut off the ImageResizer version number, so I can't really help much there.

If you switch to the Async HttpModule you may have more luck.

Replace type="ImageResizer.InterceptModule"/> with type="ImageResizer.AsyncInterceptModule"/> in Web.config.

Sign up to request clarification or add additional context in comments.

2 Comments

Okay, thanks Nathanael. Are there any gotchas I need to be aware of when using the AsyncInterceptModule? What version number is that available in?
Not really. 4.x

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.