tags:

views:

64

answers:

1

I know you can use <remove /> to remove keys. I tried to use that though for a section in my web.config, I guess that you can't remove sections? And what if I wanted to remove the entire group "webServices" ??

<sectionGroup name="webServices" type="System.Web.Configuration.ScriptingWebServicesSectionGroup, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35">
    <remove section="jsonSerialization" />
    <remove section="profileService" />
    <remove section="authenticationService" />
    <section name="jsonSerialization" type="System.Web.Configuration.ScriptingJsonSerializationSection, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" requirePermission="false" allowDefinition="Everywhere"/>
    <section name="profileService" type="System.Web.Configuration.ScriptingProfileServiceSection, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" requirePermission="false" allowDefinition="MachineToApplication"/>
    <section name="authenticationService" type="System.Web.Configuration.ScriptingAuthenticationServiceSection, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" requirePermission="false" allowDefinition="MachineToApplication"/>
</sectionGroup>

IIS is throwing a fit about the above starting with this error message:

The requested page cannot be accessed because the related configuration data for the page is invalid.

It's talking about the section above starting with the jsonSerialization and subsequent sections in that group.

A: 

<section/> only defines the type that corresponds to the section. It does not add the section itself. So why do you want to remove the section?


BTW, <remove/> only works for certain collections. These are the ones that have

<add/>
<remove/>
<clear/>
John Saunders
I am getting web.config inheritance problems from parent and need to remove the conflicting sections that IIS is throwing a fit about.
CoffeeAddict
Please edit your question with the specific, narrowed-down example. Is this a 3.5 vs. 2.0 issue?
John Saunders
what's the actual error you're getting for the conflicting sections? If it's related to collections of <add/> collections (outside of sections), add a <clear/> at the top of each collection.
Agent_9191
see updated post. I tried adding clear inside the SectionGroup (right after the first SectionGroup tag but it's not a tag that it recognizes.
CoffeeAddict