处理程序在 IIS7.5 集成管道上返回 404 错误

发布于 2024-08-26 08:45:33 字数 1162 浏览 11 评论 0原文

<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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

厌味 2024-09-02 08:45:33

我可能离这里很远,因为我离 IIS 专家很远,但我遇到了你的问题,因为我在集成模式下使用 IIS7 时也遇到了问题。我注意到的一件事是您正在使用位于 system.web 中的 httpHandlers 部分。但是,我认为对于集成模式,您需要使用 system.webServer 部分:

<system.webServer>
   <handlers>
      <add... >
   </handlers>
</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:

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

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

裸钻 2024-09-02 08:45:33

请求过滤部分中,我需要将 .axd 文件设置为允许的扩展名,我的托管公司关闭了设置允许未列出的文件扩展名,这与我的不同开发环境。

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.

假面具 2024-09-02 08:45:33

我最近将一个客户端网站从旧的 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.

开始看清了 2024-09-02 08:45:33

在尝试了很多选择之后,他们都没有成功。但是,这确实有效。在您的Appstart文件夹中,在routeconfig.cs中添加以下代码routes.IgnoreRoute("{resource}.axd/{*pathInfo}"),如下所示。

public static void RegisterRoutes(RouteCollection routes) {
            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.

public static void RegisterRoutes(RouteCollection routes) {
            routes.IgnoreRoute("{resource}.axd/{*pathInfo}");
}
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文