2017-03-02 98 views
0

我在我的ASP.NET MVC網站中使用了ImageResizer library。我試圖打開視圖預編譯來加速首頁加載時間,圖片縮放器停止工作。我得到試圖訪問一個調整圖像時以下404消息:從ImageResizer它說:「(警告)在ASP.NET MVC中使用ImageResizer進行視圖預編譯

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

在調試輸出(如下圖所示):預編譯啓用預期影像提供商可能無法正常工作。 「

有沒有什麼辦法讓他們一起工作?

故障排除指南指出找不到文件錯誤可能是因爲「您(a)未指定命令字符串,(b)已啓用預編譯,以及(c)正在使用圖像提供程序。 .NET框架中一個長期存在的bug。「什麼是命令字符串?如果我指定一個命令字符串,它會起作用嗎?如果是這樣,我該怎麼做?

調試輸出:

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 

... 
... 

回答

0

預編譯打破了所有VirtualPathProviders。我們已經完成了各種緩解措施,但是您切斷了ImageResizer版本號,所以我在這方面幫不了什麼忙。

如果你切換到Async HttpModule,你可能會有更多的運氣。

在Web.config中將type="ImageResizer.InterceptModule"/>替換爲type="ImageResizer.AsyncInterceptModule"/>

+0

好的,謝謝Nathanael。使用AsyncInterceptModule時需要注意哪些問題?哪些版本號可用? – Austin

+0

不是。 4.x版 –