none
WCF TestClient Issue

    Question

  • I am new to WCF.

    I have developed a sample service using the WCF Library Project Template in Windows Server 2008 R2 x64/ VSS 2010.

    When I run the project by pressing F5, the WCF Test Client to is getting launched but fails with the following message.

    ---------------------------

    Microsoft WCF Test Client

    ---------------------------

    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.

    ---------------------------

    OK  

    ---------------------------

    Please could someone point me in the right direction?

    Thanks

    Shiva S


    Shiva Sadayan
    Monday, December 20, 2010 5:58 PM

Answers

  • Hi,

    If you have installed the Biztalk Services SDK on top of VS 2008 SP1, the Biztalk Service SDK introduces an endpoint with relayBinding in the <client> section of the <system.serviceModel> element in the machine.config file.

     

    When adding a service to WCF Test Client, an unrecognized endpoint will be generated whose contract is IMetadataExchange. Then Test Client will report error: “The contract ‘IMetadataExchange’ in client configuration does not match the name in service contract…”.

    Check the following blog for solution:

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

     

    Thanks

    Binze


    Binze Zhao [MSFT]
    MSDN Community Support | Feedback to us
    Get or Request Code Sample from Microsoft
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    • Marked as answer by Bin-ze Zhao Monday, December 27, 2010 3:15 AM
    Wednesday, December 22, 2010 8:58 AM
  • Use WCFStorm LITE to test your WCF serice, it wil give u the errors very clearly and elapsed time also

     

    u can download from the following link

    http://www.wcfstorm.com/wcf/wcfstorm-lite.aspx

     

    Regards

    DurgaPrasad

    • Marked as answer by Bin-ze Zhao Monday, December 27, 2010 3:15 AM
    Wednesday, December 22, 2010 10:29 AM

All replies

  • are you sure the problem is only with the wcf test client? try to view the wsdl in IE and see if that works. also configure wcf trace on the service to see detailed errors.
    http://webservices20.blogspot.com/
    WCF Security, Interoperability And Performance Blog
    Monday, December 20, 2010 6:42 PM
  • I haven't tried the WSDL stuff mentioned above but one thing I know is this happened in every single project I created using the WCF Library Project Template.

    OOTB WCF Library Project Template comes with a sample code - whilst trying to run the sample code encountered the same error.

    ---------------------------

    Microsoft WCF Test Client

    ---------------------------

    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.

    ---------------------------

    OK  

    ---------------------------


    Shiva Sadayan
    Tuesday, December 21, 2010 12:57 PM
  • does this happen with wcf web project? can you publish the config of your library project?
    http://webservices20.blogspot.com/
    WCF Security, Interoperability And Performance Blog
    Tuesday, December 21, 2010 2:07 PM
  • I haven't tried with the web project

    Here is the sample App.Config (OOTB for WCF Library Project Template)

    <?xml version="1.0" encoding="utf-8" ?>
    <configuration>

      <system.web>
        <compilation debug="true" />
      </system.web>
      <!-- When deploying the service library project, the content of the config file must be added to the host's
      app.config file. System.Configuration does not support config files for libraries. -->
      <system.serviceModel>
        <services>
          <service name="WcfServiceLibrary1.Service1" behaviorConfiguration="WcfServiceLibrary1.Service1Behavior">
            <host>
              <baseAddresses>
                <add baseAddress = "http://localhost:8732/Design_Time_Addresses/WcfServiceLibrary1/Service1/" />
              </baseAddresses>
            </host>
            <!-- Service Endpoints -->
            <!-- Unless fully qualified, address is relative to base address supplied above -->
            <endpoint address ="" binding="wsHttpBinding" contract="WcfServiceLibrary1.IService1">
              <!--
                  Upon deployment, the following identity element should be removed or replaced to reflect the
                  identity under which the deployed service runs.  If removed, WCF will infer an appropriate identity
                  automatically.
              -->
              <identity>
                <dns value="localhost"/>
              </identity>
            </endpoint>
            <!-- Metadata Endpoints -->
            <!-- The Metadata Exchange endpoint is used by the service to describe itself to clients. -->
            <!-- This endpoint does not use a secure binding and should be secured or removed before deployment -->
            <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange"/>
          </service>
        </services>
        <behaviors>
          <serviceBehaviors>
            <behavior name="WcfServiceLibrary1.Service1Behavior">
              <!-- To avoid disclosing metadata information,
              set the value below to false and remove the metadata endpoint above before deployment -->
              <serviceMetadata httpGetEnabled="True"/>
              <!-- To receive exception details in faults for debugging purposes,
              set the value below to true.  Set to false before deployment
              to avoid disclosing exception information -->
              <serviceDebug includeExceptionDetailInFaults="False" />
            </behavior>
          </serviceBehaviors>
        </behaviors>
      </system.serviceModel>

    </configuration>

    Thanks

    Shiva S


    Shiva Sadayan
    Tuesday, December 21, 2010 2:13 PM
  • can you see the wsdl in IE? if so try to open the wcf test client manually and add this wsdl.

    it is usually under:

    C:\Program Files\Microsoft Visual Studio 9.0\Common7\IDE\WcfTestClient.exe


    http://webservices20.blogspot.com/
    WCF Security, Interoperability And Performance Blog
    Tuesday, December 21, 2010 2:25 PM
  • Hi,

    If you have installed the Biztalk Services SDK on top of VS 2008 SP1, the Biztalk Service SDK introduces an endpoint with relayBinding in the <client> section of the <system.serviceModel> element in the machine.config file.

     

    When adding a service to WCF Test Client, an unrecognized endpoint will be generated whose contract is IMetadataExchange. Then Test Client will report error: “The contract ‘IMetadataExchange’ in client configuration does not match the name in service contract…”.

    Check the following blog for solution:

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

     

    Thanks

    Binze


    Binze Zhao [MSFT]
    MSDN Community Support | Feedback to us
    Get or Request Code Sample from Microsoft
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    • Marked as answer by Bin-ze Zhao Monday, December 27, 2010 3:15 AM
    Wednesday, December 22, 2010 8:58 AM
  • Use WCFStorm LITE to test your WCF serice, it wil give u the errors very clearly and elapsed time also

     

    u can download from the following link

    http://www.wcfstorm.com/wcf/wcfstorm-lite.aspx

     

    Regards

    DurgaPrasad

    • Marked as answer by Bin-ze Zhao Monday, December 27, 2010 3:15 AM
    Wednesday, December 22, 2010 10:29 AM