处理程序在 IIS7.5 集成管道上返回 404 错误
<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>
我在集成模式下使用iis7.5时遇到问题。当我在经典模式处理程序中使用它时,上面介绍的工作正常,但如果我切换到集成管道 - 所有应处理的请求都会返回 404 错误。为什么?
<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?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
我可能离这里很远,因为我离 IIS 专家很远,但我遇到了你的问题,因为我在集成模式下使用 IIS7 时也遇到了问题。我注意到的一件事是您正在使用位于 system.web 中的 httpHandlers 部分。但是,我认为对于集成模式,您需要使用 system.webServer 部分:
如果我错了,希望知道自己在说什么的人会纠正我。
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:
Hopefully someone who knows what they're talking about will correct me if I'm wrong.
在
请求过滤
部分中,我需要将 .axd 文件设置为允许的扩展名,我的托管公司关闭了设置允许未列出的文件扩展名
,这与我的不同开发环境。In the
Request Filtering
section I needed to set .axd files as an Allowed extension, my hosting company had the settingAllow unlisted file name extensions
turned off, which was different to my development environment.我最近将一个客户端网站从旧的 IIS6 安装迁移到 IIS7。当他们调用 .axd 时,他们的应用程序也遇到了 404 错误。他们的站点设置为 .net 2,权限正确,处理程序看起来都很好。最终将他们的应用程序池从“托管管道模式”集成更改为经典,这解决了他们的应用程序的问题。
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.
在尝试了很多选择之后,他们都没有成功。但是,这确实有效。在您的Appstart文件夹中,在routeconfig.cs中添加以下代码routes.IgnoreRoute("{resource}.axd/{*pathInfo}"),如下所示。
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.