ImageResizer在使用Visual Studio进行测试时工作,而不是在生产环境中工作



我通过NuGet安装了ImageResizer,当我运行ASP时,它运行良好。Net MVC网站。我可以访问/resizer.debug页面,它显示一切都很好。

当我将网站从Visual Studio发布到同一台计算机上的主IIS实例时,ImageResizer不起作用,当我浏览到/resizer.debug时,我收到一个404 not Found错误。

我已经发布了web.config,并验证了所有图像调整大小器组件都在其中。例如:

<httpModules><add name="ImageResizingModule" type="ImageResizer.InterceptModule" /></httpModules></system.web>

ImageResizer dll也在/bin目录中。

但是,什么都没有发生,调试页面也不会显示。

发布项目时,是否需要在IIS7上配置ImageResizer?

您似乎只为IIS Classic配置了它,而不是IIS7集成模式。必须有一个已安装模块的<system.webServer>元素。

来自安装指南:

 <?xml version="1.0" encoding="utf-8" ?>
 <configuration>
   <configSections>
     <section name="resizer" type="ImageResizer.ResizerSection,ImageResizer"  requirePermission="false"  />
   </configSections>
   <resizer>
     <!-- Unless you (a) use Integrated mode, or (b) map all requests to ASP.NET, 
          you'll need to add .ashx to your image URLs: image.jpg.ashx?width=200&height=20 -->
     <pipeline fakeExtensions=".ashx" defaultCommands="autorotate.default=true"/>
     <plugins>
       <add name="DiskCache" />
       <!-- <add name="PrettyGifs" /> -->
       <!-- <add name="SimpleFilters" /> -->
       <!-- <add name="S3Reader" /> -->
     </plugins>  
   </resizer>
   <system.web>
     <httpModules>
       <!-- This is for IIS7/8 Classic Mode and Cassini-->
       <add name="ImageResizingModule" type="ImageResizer.InterceptModule"/>
     </httpModules>
   </system.web>
   <system.webServer>
     <validation validateIntegratedModeConfiguration="false"/>
     <modules>
       <!-- This is for IIS7/8 Integrated mode -->
       <add name="ImageResizingModule" type="ImageResizer.InterceptModule"/>
     </modules>
   </system.webServer>
 </configuration>

相关内容

最新更新