Handlers returns 404 error on IIS7.5 integrated pipeline

旧城冷巷雨未停 提交于 2019-12-04 03:54:34

问题


<httpHandlers>
  <add path="ajaxpro/*.ashx" verb="POST,GET" type="AjaxPro.AjaxHandlerFactory, AjaxPro.2" />
  <add path="Reserved.ReportViewerWebControl.axd" verb="*" type="Microsoft.Reporting.WebForms.HttpHandler, Microsoft.ReportViewer.WebForms, Version=9.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" validate="false" />
  <remove verb="*" path="*.asmx" />
  <add verb="*" path="*.asmx" validate="false" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
  <add verb="*" path="*_AppService.axd" validate="false" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
  <add verb="GET,HEAD" path="ScriptResource.axd" validate="false" type="System.Web.Handlers.ScriptResourceHandler, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
</httpHandlers>

I have a problem with iis7.5 in integrated mode. When I use it in classic mode handlers that presented above work fine, but if I switch to the integrated pipeline - all requests that should be handled return 404 error. Why?


回答1:


I could be miles off here because I'm as far from an IIS expert as it's possible to be, but I came across your question since I too am having trouble with IIS7 in integrated mode. One thing I notice is that you're using the httpHandlers section, which sits in system.web. However, I think for integrated mode you need to use the system.webServer section:

<system.webServer>
   <handlers>
      <add... >
   </handlers>
</system.webServer>

Hopefully someone who knows what they're talking about will correct me if I'm wrong.




回答2:


In the Request Filtering section I needed to set .axd files as an Allowed extension, my hosting company had the setting Allow unlisted file name extensions turned off, which was different to my development environment.




回答3:


I recently moved a client website from an old IIS6 to IIS7 installation. They were running into 404s on their application when calling .axd also. Their site was set to .net 2, permissions correct, handlers all looked good. Ended up changing their application pool from "Managed Pipeline Mode" Integrated to Classic, this solved the problem for their application.




回答4:


After trying a lot of the options, they didn't work out. But however, this worked. In your Appstart folder add this code routes.IgnoreRoute("{resource}.axd/{*pathInfo}") in routeconfig.cs as shown below.

public static void RegisterRoutes(RouteCollection routes) {
            routes.IgnoreRoute("{resource}.axd/{*pathInfo}");
}


来源:https://stackoverflow.com/questions/2498723/handlers-returns-404-error-on-iis7-5-integrated-pipeline

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!