I'm trying to replace the default machine.config settings for the "client" handler with my own handler, however, when i run it, i'm getting this error:
"Section or group name 'client' is already defined. Updates to this may only occure at the configuration level where it is defined."
here is how my app.config looks like:
<configuration>
<configSections>
<remove name="client"/>
<sectionGroup name="system.serviceModel" type="System.ServiceModel.Configuration.ServiceModelSectionGroup, System.ServiceModel, Version=3.0.0.0, Culture=neut开发者_开发问答ral, PublicKeyToken=b77a5c561934e089">
<section name="client" type="xyz.Messaging.CustomClientSection, Point.Messaging" />
</sectionGroup>
</configSections>
Please let me know if you have any idea why it seems like that it doesn't remove this section (as one would expect) and gives me this error instead.
Thanks.
AFAIK, you can't do this. The <client>
sub-section is strongly tied to the ServiceModelSectionGroup
via its Client
property.
You can do this, but you'll have to remove and re-add the entire system.serviceModel section. I don't think you can cherry-pick out just the "client" subsection.
<configuration>
<configSections>
<remove name="system.serviceModel"/>
<sectionGroup name="system.serviceModel" type="System.ServiceModel.Configuration.ServiceModelSectionGroup, System.ServiceModel, Version=3.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<section name="client" type="xyz.Messaging.CustomClientSection, Point.Messaging" />
</sectionGroup>
</configSections>
...
</configuration>
It'll be a bit of work, of course. Hopefully this is helpful, but I have a feeling you won't like this answer.
The only way this could work for removing a subsection is if a sectionGroup element supported the <remove>
element, which it doesn't: http://msdn.microsoft.com/en-us/library/ms228114.aspx
Hope this was helpful.
精彩评论