在Web.Config中找不到HttpHandlerSection [英] HttpHandlerSection not found in Web.Config

查看:155
本文介绍了在Web.Config中找不到HttpHandlerSection的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个旧的WebControl,需要更新才能使用IIS 7.5。



在控件中有一些代码可以检查Handler是否已注册Web.Config。

它使用

I have an old WebControl that needs to be updated to work with IIS 7.5.

In the control there is some code that checks if the Handler is registered in the Web.Config.
It opens the HandlerSection using

System.Web.Configuration.HttpHandlersSection handlerSection = System.Web.Configuration.WebConfigurationManager.GetWebApplicationSection("system.web/httpHandlers") as System.Web.Configuration.HttpHandlersSection;

在IIS 6上正常工作。但是在IIS 7和转发处理器部分已从< system.web>< httpHandlers> < system.webServer>< handlers>

将代码更改为

which works fine on IIS 6. But on IIS 7 and forward the Handler Section has been moved from <system.web><httpHandlers> to <system.webServer><handlers>
Changing the code to

System.Web.Configuration.HttpHandlersSection handlerSection = System.Web.Configuration.WebConfigurationManager.GetWebApplicationSection("system.webServer/handlers") as HttpHandlersSection;

不起作用,handlersection为null 。



那么,我做错了什么?



我已经摆弄了一下它将其更改为

doesn't work, handlersection is null.

So, what am I doing wrong?

I've fiddled with it a bit and changing it to just

System.Web.Configuration.HttpHandlersSection handlerSection = System.Web.Configuration.WebConfigurationManager.GetWebApplicationSection("system.webServer") as System.Web.Configuration.HttpHandlersSection;

给我一​​个InvalidCastException。 无法将'System.Configuration.IgnoreSection'类型的对象强制转换为'System.Web.Configuration.HttpHandlersSection'。

gives me an InvalidCastException. "Unable to cast object of type 'System.Configuration.IgnoreSection' to type 'System.Web.Configuration.HttpHandlersSection'."

推荐答案

这篇关于在Web.Config中找不到HttpHandlerSection的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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