IIS 7、HttpHandler 和 HTTP 错误 500.21 [英] IIS 7, HttpHandler and HTTP Error 500.21

查看:31
本文介绍了IIS 7、HttpHandler 和 HTTP 错误 500.21的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在 IIS 7 上,我正在尝试为我的 ASP.NET Web 应用程序使用自定义 HttpHandler.我使用管道模式经典",.NET 版本是 4.0.30319,我的处理程序的 web.config 配置是:

On IIS 7, I'm trying to use custom HttpHandler for my ASP.NET web application. I use pipeline mode "classic", .NET version is 4.0.30319, my web.config configuration for the handler is:

<system.webServer>
<handlers>
    <add name="MyHandler" path="*.myExtension" verb="*" type="Company.App.UI.Controls.MyHandler, Company.App.UI" resourceType="Unspecified" />
</handlers>
</system.webServer> 

当我调用这个处理程序时,我得到这个错误:

When I invoke this handler, I get this error:

HTTP Error 500.21 - Internal Server Error
Handler "MyHandler" has a bad module "ManagedPipelineHandler" in its module list

我进行了谷歌搜索,大多数人通过 aspnet_regiis.exe/i 命令重新注册 ASP.NET 来解决此问题,但这对我不起作用(命令结束,我重新启动了 IIS,但同样的错误).我在两台不同的服务器上尝试过,但得到了相同的结果.

I did a google search, the most of people fix this issue by re-registering ASP.NET by aspnet_regiis.exe /i command, but this is not working for me (the command finishes, I restart the IIS, but same error). I tried it on two different servers, but got the same result.

我还应该尝试什么?谢谢

What else should I try? Thank you

推荐答案

无法将 IIS 托管处理程序配置为在经典模式下运行.如果你想这样做,你应该在集成模式下运行 IIS.

It's not possible to configure an IIS managed handler to run in classic mode. You should be running IIS in integrated mode if you want to do that.

您可以在以下博客文章中了解有关模块、处理程序和 IIS 模式的更多信息:

You can learn more about modules, handlers and IIS modes in the following blog post:

IIS 7.0、ASP.NET、管道、模块、处理程序和先决条件

对于处理程序,如果您在映射,处理程序将仅在集成模式下运行.在另一方面,如果您设置 preCondition="classicMode" 处理程序将只在经典模式下运行.如果你省略这两个,处理程序可以在两种模式下运行,尽管这对于托管处理程序.

For handlers, if you set preCondition="integratedMode" in the mapping, the handler will only run in integrated mode. On the other hand, if you set preCondition="classicMode" the handler will only run in classic mode. And if you omit both of these, the handler can run in both modes, although this is not possible for a managed handler.

这篇关于IIS 7、HttpHandler 和 HTTP 错误 500.21的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆