当前位置 主页 > iis相关 >

    解决在IIS7不能显示axd中图片的方法

    栏目:iis相关 时间:2018-09-07 15:29

      原因:IIS7服务器默认没有支持axd格式的MIME。
     
      解决方法:通过修改Web.config来解决。
     
       <system.webServer>
     
       <validationvalidateIntegratedModeConfiguration="false"/>
     
       <modules>
     
       <removename="ScriptModule"/>
     
       <addname="ScriptModule"preCondition="managedHandler"type="System.Web.Handlers.ScriptModule,System.Web.Extensions,Version=3.5.0.0,Culture=neutral,PublicKeyToken=31BF3856AD364E35"/>
     
       </modules>
     
       <handlers>
     
       <removename="WebServiceHandlerFactory-Integrated"/>
     
       <removename="ScriptHandlerFactory"/>
     
       <removename="ScriptHandlerFactoryAppServices"/>
     
       <removename="ScriptResource"/>
     
       <addname="ScriptHandlerFactory"verb="*"path="*.asmx"preCondition="integratedMode"type="System.Web.Script.Services.ScriptHandlerFactory,System.Web.Extensions,Version=3.5.0.0,Culture=neutral,PublicKeyToken=31BF3856AD364E35"/>
     
       <addname="ScriptHandlerFactoryAppServices"verb="*"path="*_AppService.axd"preCondition="integratedMode"type="System.Web.Script.Services.ScriptHandlerFactory,System.Web.Extensions,Version=3.5.0.0,Culture=neutral,PublicKeyToken=31BF3856AD364E35"/>
     
       <addname="ScriptResource"preCondition="integratedMode"verb="GET,HEAD"path="ScriptResource.axd"type="System.Web.Handlers.ScriptResourceHandler,System.Web.Extensions,Version=3.5.0.0,Culture=neutral,PublicKeyToken=31BF3856AD364E35"/>
     
      <addname="WebResource"verb="GET"path="WebResource.axd"preCondition="integratedMode"type="System.Web.Handlers.AssemblyResourceLoader"/>
     
       <addname="cachedimageservice"verb="GET"path="cachedimageservice.axd"preCondition="integratedMode"type="MsdnMag.CachedImageService,DynamicImage"/>
     
       <addname="Reserved.ReportViewerWebControl"verb="*"path="Reserved.ReportViewerWebControl.axd"preCondition="integratedMode"type="Microsoft.Reporting.WebForms.HttpHandler,Microsoft.ReportViewer.WebForms,Version=9.0.0.0,Culture=neutral,PublicKeyToken=b03f5f7f11d50a3a"/>
     
       </handlers>
     
      <staticContent>
     
      <removefileExtension=".axd"/>
     
      <mimeMapfileExtension=".axd"mimeType="image/bmp"/>
     
      </staticContent>
     
       </system.webServer>
     
      关键是其中跟axd相关的配置。