问题
I am using ImageResizer in my website with DiskCache plugin enabled. Randomly for some images it shows another file in the output and I should clear the cache to fix this problem while after some time I see this again for other images. Wrong image is cached just for one size of the image.
And one more thing: some times in chrome where image resizer shows wrong image this problem is solved by Ctrl+F5.
Edit 1: This is my Web.config file:
<resizer>
<diagnostics enableFor="AllHosts" />
<pipeline fakeextensions=".aspx" />
<plugins>
<add name="Mybook.utilities.ImageResizerLocalReader" />
</plugins>
<diskCache dir="~/imagecache" autoClean="false" hashModifiedDate="true" />
<clientcache minutes="10080" />
</resizer>
<system.web>
<httpModules>
<add name="ImageResizingModule" type="ImageResizer.InterceptModule"/>
</httpModules>
</system.web>
...
<system.webServer>
<modules>
<add name="ImageResizingModule" type="Mybook.utilities.ImageInterceptModule" />
</modules>
</system.webServer>
I still can't see diagnostic page
回答1:
Remove your custom plugin and your custom HttpHandler.
Delete
<modules>
<add name="ImageResizingModule" type="Mybook.utilities.ImageInterceptModule" />
</modules>
Replace with
<modules>
<add name="ImageResizingModule" type="ImageResizer.InterceptModule" />
</modules>
And remove
<add name="Mybook.utilities.ImageResizerLocalReader" />
Also, change <pipeline fakeextensions=".aspx" />
to <pipeline fakeextensions=".ashx" />
, you don't want to conflict with web pages.
Last, move this to a new, clean, standard web application in that does not map itself to the root of the C:\
drive or do anything else crazy. Don't put web apps in the root or in a user folder. Use Inetpub or c:\www\myapp
or something; double check your NTFS permissions are correct.
If you still experience the issue after you've eliminated environmental problems, then you should open a new question with simplified reproduction steps.
UPDATE
This was caused by a global variable in the custom plugin.
来源:https://stackoverflow.com/questions/32242470/imageresizer-shows-wrong-image