Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

WCF custom binding/extensions causes validation error in app.config

Tags:

wcf

I was curious if anyone knew how to fix this: When I add a bindingExtension or bindingElementExtension to my WCF config, Visual Studio throws a schema validation warning, because the name of the extension is not in the system.serviceModel schema:

Warning 1 The element 'bindings' has invalid child element 'nmsBinding'. List of possible elements expected: 'basicHttpBinding, customBinding, msmqIntegrationBinding, netPeerTcpBinding, netMsmqBinding, netNamedPipeBinding, netTcpBinding, wsFederationHttpBinding, ws2007FederationHttpBinding, wsHttpBinding, ws2007HttpBinding, wsDualHttpBinding, mexHttpBinding, mexHttpsBinding, mexNamedPipeBinding, mexTcpBinding, webHttpBinding, netTcpContextBinding, wsHttpContextBinding, basicHttpContextBinding'.

This might be a dumb question, but is there a way to "dynamically" register these extensiions with visual studio, so that they validate? I was thinking I could drop an xsd somewhere in the visual studio configs, but I'd rather not do that if there's some other magical way.

Here is what my serviceModel config looks like:

<system.serviceModel>

    <services>
        <service name="Zed.Apache.NMS.WCF.Test.Server.TestApacheNMSService">
            <endpoint
                name="nmsServiceEndpoint"
                address="tcp://localhost:61616"
                binding="nmsBinding"
                bindingConfiguration="defaultNmsBinding" 
                contract="Zed.Apache.NMS.WCF.Test.Server.ITestApacheNMSService" />
        </service>
    </services>

    <bindings>
        <nmsBinding> <!-- VALIDATION ERROR HERE -->
            <binding name="defaultNmsBinding"
                     destination="TestApacheNMSQueue"
                     destinationType="Queue" />
        </nmsBinding>
    </bindings>

    <extensions>
        <bindingExtensions>
            <add name="nmsBinding"
                 type="Apache.NMS.WCF.NmsBindingCollection, Zed.Apache.NMS.WCF, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null" />
        </bindingExtensions>
    </extensions>

</system.serviceModel>
like image 372
Andy White Avatar asked Oct 28 '25 20:10

Andy White


1 Answers

I believe VS2008 uses the file "C:\Program Files\Microsoft Visual Studio 9.0\xml\Schemas\DotNetConfig.xsd" (with default installation) for validation of the config file. You can change this file or specify another schema under "Properties" for the config file.

However, as long as you are only receiving design time warnings, it may not be worth the trouble.

like image 122
Jakob Christensen Avatar answered Nov 04 '25 03:11

Jakob Christensen



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!