繁体   English   中英

将ImageResizer与ASP.NET MVC中的视图预编译一起使用

[英]Use ImageResizer with view precompilation in ASP.NET MVC

我在ASP.NET MVC网站中使用ImageResizer库 我试图打开视图预编译以加快首页加载时间,并且图像缩放器停止工作。 尝试访问调整大小的图像时收到以下404消息:

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

在ImageResizer的调试输出(如下所示)中,它显示“(警告):启用了预编译。图像提供程序可能无法按预期运行。”

有什么办法可以使他们一起工作?

故障排除指南说,找不到文件错误可能是因为“(a)您未指定命令字符串,(b)启用了预编译,并且(c)使用了图像提供程序。这是由于长期存在的原因.NET框架中的错误。” 什么是命令字符串? 如果指定命令字符串,它将起作用吗? 如果是这样,我该怎么做?

调试输出:

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

...
...

预编译会破坏所有VirtualPathProvider。 我们已经进行了各种缓解措施,但是您切断了ImageResizer的版本号,因此在此我无济于事。

如果您切换到异步HttpModule,则可能会有更多运气。

替换type="ImageResizer.InterceptModule"/>type="ImageResizer.AsyncInterceptModule"/> Web.config中。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM