2017-03-02 95 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版 –