views:

32

answers:

1

WCF Custom BehaviorExtension Error: An extension "silverlightFaults" already appears in extension

collection. Extension names must be unique.

I have a custom behaviorExtension for a silverlight project which helps in communicating faultcontract

messages to client. This error occurs when the service is called. Works good in Dev and QA boxes but

not in PROD test server. Any ideas of where to start and how to debug ?

Platform: .NET 3.5, Silverlight, WCF, Win2003 x64

Any help is appreciated.

web.config section:

<extensions>
    <behaviorExtensions>
        <add name="silverlightFaults"
            type="Mrr.Srsa.Services.SilverlightFaultBehavior, Mrr.Srsa.Services, Version=1.0.0.0, 

Culture=neutral, PublicKeyToken=9e9f5a95ab06f177"/>
    </behaviorExtensions>
</extensions>
<behaviors>   
    <endpointBehaviors>
        <behavior name="SilverlightFaultBehavior">
            <silverlightFaults />
        </behavior>
    </endpointBehaviors>
</behaviors>
A: 

Well, the Exception pretty much says it all: somewhere higher up in the configuration hierarchy (web.config in a higher level directory / machine.config etc.) there is already an extension named silverlightFaults. Try to stick a <clear /> between <behaviorExtensions> and <add name="silverlightFault" ... />

--larsw

larsw
Thanks for the reply, I didn't try the <clear/> but found the issue. On comparing the IISconfig from prod and dev found that in the prod server both the main website and virtual directory was pointing to the same physical location. (And so the web.config was parsed twice and the error). Resolved it by pointing the main website to the main root level directory.
GS