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.Scri开发者_如何学PythonptingJsonSerializationSection, 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.
<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/>
精彩评论