开发者

Redeclaring configSection element in child application

For various technical reasons which I won't bore you with here, I need to redeclare a section declaration in the configSections section of an ASP.NET 2.0 application which is configured as a child app of another ASP.NET 2.0 application. This is required so the child application can use a different type (same name, different assembly) for the section implementation.

I have tried using the remove element to remove the parent declaration, but the ASP.NET runtime throws an exception stating that the section is already defined. I have also tried to use the clear element, but that removes ALL declared section elements, including those in machine.config. And if I manually add all the required section elements from machine.config, I still get the same error ab开发者_如何学编程out the duplicate section.

Is there any way that I can change the declaration of a section element so it will resolve to a different type in the manner that I am trying to achieve here?


No, I'm not aware of any documented, supported way of doing this. Once a config section has been configured and declared, there's no way to override or clear that definition.

You can do a lot with the .NET 2.0 config system, including "externalizing" config sections into external files - but I haven't ever heard about a method to "unconfigure" a configuration section.

I don't see how you can get this to work - other than the obvious solution: call the section something else in your child app....

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜