WCF Test Client Error: ‘IMetadataExchange’ not match

http://www.zizhujy.com/blog/post/2012/04/01/WCF-Test-Client-Error-IMetadataExchange-not-match.aspx

Problem:

When adding a service in your WCF Test Client, you meet this issue says:

The contract ‘IMetadataExchange’ in client configuration does not match the name in service contract, or there is no valid method in this contract.
To recover, please manually correct client configuration.
Or restore to default configuration.
Or check "Always regenerate config when launching services" in the
Tools -> Options menu, then refresh the service.

The screen shot:

WCF Test Client Error: ‘IMetadataExchange’ not match

After you click “OK”, the service node will appear in the tree with the redundant “IMetadataExchange (sb)”, “IMetadataExchange (sap)”, … sections.

WCF Test Client Error: ‘IMetadataExchange’ not match

Cause:

Caused by BizTalk according to http://blogs.msdn.com/b/wcftoolsteamblog/archive/2008/08/28/tips-for-wcf-tools-in-vs2008-sp1.aspx.

Solution:

When you run the WCF Test Client, modify the machine.config file (located in C:\Windows\Microsoft.NET\Framework\v4.0.30319\Config)

machine.config

by commenting out the <client /> section below that is nested in the <system.serviceModel> element.

  &lt;!--
        &lt;client&gt;
            &lt;endpoint address="" binding="netTcpRelayBinding" contract="IMetadataExchange" name="sb"/&gt;
            &lt;endpoint binding="sapBinding" contract="IMetadataExchange" name="sap"/&gt;
            &lt;endpoint binding="siebelBinding" contract="IMetadataExchange" name="siebel"/&gt;
            &lt;endpoint binding="sqlBinding" contract="IMetadataExchange" name="mssql"/&gt;
            &lt;endpoint binding="oracleEBSBinding" contract="IMetadataExchange" name="oracleebs"/&gt;
            &lt;endpoint binding="oracleDBBinding" contract="IMetadataExchange" name="oracledb"/&gt;
            &lt;metadata&gt;
                &lt;policyImporters&gt;
                    &lt;extension type="System.ServiceModel.Channels.ContextBindingElementImporter, System.ServiceModel, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089, processorArchitecture=MSIL"/&gt;
                    &lt;extension type="Microsoft.ServiceBus.Description.TcpRelayTransportBindingElementImporter, Microsoft.ServiceBus, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/&gt;
                    &lt;extension type="Microsoft.ServiceBus.Description.HttpRelayTransportBindingElementImporter, Microsoft.ServiceBus, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/&gt;
                    &lt;extension type="Microsoft.ServiceBus.Description.OnewayRelayTransportBindingElementImporter, Microsoft.ServiceBus, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/&gt;
                &lt;/policyImporters&gt;
                &lt;wsdlImporters&gt;
                    &lt;extension type="System.ServiceModel.Channels.ContextBindingElementImporter, System.ServiceModel, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089, processorArchitecture=MSIL"/&gt;
                    &lt;extension type="Microsoft.ServiceBus.Description.StandardRelayBindingImporter, Microsoft.ServiceBus, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/&gt;
                    &lt;extension type="Microsoft.ServiceBus.Description.TcpRelayTransportBindingElementImporter, Microsoft.ServiceBus, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/&gt;
                    &lt;extension type="Microsoft.ServiceBus.Description.HttpRelayTransportBindingElementImporter, Microsoft.ServiceBus, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/&gt;
                    &lt;extension type="Microsoft.ServiceBus.Description.OnewayRelayTransportBindingElementImporter, Microsoft.ServiceBus, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/&gt;
                &lt;/wsdlImporters&gt;
            &lt;/metadata&gt;
        &lt;/client&gt;
  --&gt;
After that, restart your WCF Test Client you will get rid of this error.
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s