Tips for WCF Tools in VS2008 SP1

In this article, I would like to share some tips of WCF Tools in VS2008 SP1. Hope this can help your better use these tools.

WCF Test Client: How to change the folder that stores temporary client configuration files and assembly files

 

Prior to VS2008 SP1, WCF Test Client put the temporary client configuration files and assembly files in “My Document” folder. When this folder is set as a network share, sometimes WCF Test Client cannot invoke services with the error message: “An error occurred creating the configuration section handler for system.serviceModel/bindings: That assembly does not allow partially trusted callers…”

In VS2008 SP1, we improve the experience:

First, we change the default folder from “My Document” to %temp%, because %temp% folder has less probability to be set as a network share.

Second, we also offer command line options to let the folder configurable. You can change it to your specific folder and can also restore to the default one. Snapshot below shows the detailed format of these commands.

WCF Test Client fails to add services with mismatched svcutil version

 

Sometimes, when svcutil.exe isn’t properly installed or installed with an earlier version in Windows SDK v6.1, WCF Test Client won’t work with the error message: “Error: Unrecognized option ‘targetclientversion’ specified.”

Please double check the below version info:

- The SvcUtil.exe shipped with Windows SDK v6.0A (which comes with VS 2008) is of version 3.0.4506.648 or above

- The SvcUtil.exe shipped with Windows SDK v6.1 is also of version 3.0.4506.648 or above

- The WcfTestClient.exe shipped with VS 2008 is of version 9.0.588.0

If the version number is wrong or svcutil.exe isn’t properly installed, the resolution is:

- Install the latest version of Windows SDK

- Or copy svcutil.exe from Windows SDK v6.0A to Windows SDK v6.1

Installing Biztalk Services SDK will introduce an unrecognized endpoint to WCF Test Client

 

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…”. The screenshot is attached below:

After you click “OK”, the service node will appear in the tree with the redundant “IMetadataExange (sb)” section. There is no impact for the functionalities.

The screenshot is attached below:

If you will frequently add services to WCF Test Client, there is a work around to avoid the inconvenient error message:

When you run the WcfTestClient, modify the machine.config file (located in \WINDOWS\Microsoft.NET\Framework\v2.0.50727\CONFIG) by commenting out the <client> section below that is nested in the <system.serviceModel> element. Re-enable the section when you use the Biztalk Services SDK.

<client>

   <endpoint address="" binding="relayBinding" bindingConfiguration="metadataExchangeRelayBinding"

contract="IMetadataExchange" name="sb" />

</client>

<bindings>

   <relayBinding>

    <binding name="metadataExchangeRelayBinding" />

   </relayBinding>

  </bindings>

Service Configuration Editor cannot be launched in VS after some improper installation steps

 

A customer reported a issue, and I would like to share with you here.

The user has VS2008 SP1 Beta, .net3.5 SP1 Beta and Windows SDK v6.1 installed in his machine, and then he installed VS2008 SP1 release and .net3.5 SP1 release. There should be some improper steps.

When he created a new WCF Service Library project and tried to launch Service Configuration Editor (SvcConfigEdior.exe) to edit the app.config file, an error dialog pop up:

There are two issues:

- SvcConfigEditor.exe in v6.0A seems disappear

- Windows SDK v6.0A is still the default SDK after installing Windows SDK v6.1. So VS tried to find SvcConfigEditor.exe in Window SDK v6.0A

To resolve the problem, I will recommend using the “Windows SDK Configuration Tool” to set the default SDK.

 

To avoid this problem, please make sure to uninstall the Beta versions first: not only the related programs but also the updates, before installing the Release versions.

Comments

  • Anonymous
    August 27, 2008
    PingBack from http://informationsfunnywallpaper.cn/?p=2666

  • Anonymous
    March 06, 2009
    Thank you for the article. It is very helpful and has lots of good tips!

  • Anonymous
    February 11, 2010
    “IMetadataExange (sb)” Comes up even withuot BizTalk....

  • Anonymous
    November 26, 2010
    Installing Biztalk Services SDK will introduce an unrecognized endpoint to WCF Test Client: "There is no impact for the functionalities." If I am using the test client out of Visual Studio 2010, I comment those out:      <endpoint binding="sapBinding" contract="IMetadataExchange" name="sap"/>      <endpoint binding="sqlBinding" contract="IMetadataExchange" name="mssql"/>      <endpoint binding="oracleEBSBinding" contract="IMetadataExchange" name="oracleebs"/>      <endpoint binding="oracleDBBinding" contract="IMetadataExchange" name="oracledb"/> However the entire application fails by stating: Assembly Oracle.DataAccess, Version=2.111.7.0 ... was not found. Reinstall the assembly or Visual Studio. The application cannot continue and will exit. I am attempting to test a WCF service, and this tool should assist, but it closes regardless of how I modify the machine.config.

  • Anonymous
    January 13, 2011
    I did the same steps as Eric Stott and get the same result. Using OS: Windows 2008 R2, I do have biztalk skd 2010 installed, using Visual studio 2010.

  • Anonymous
    January 13, 2011
    To solve I commented out some additional lines involving oracle client, and then all worked.

  • Anonymous
    February 09, 2011
    I got the same error as Eric Stott  &  utekai. Thanks utekai. Commenting out all oracle related lines in machine.config resolves the issue.

  • Anonymous
    February 21, 2012
    Removing 'IMetadataExchange' from the MACHINE.CONFIG' is not NOT an option, I use WCF services with BizTalk so how is that going to help me?

  • Anonymous
    April 19, 2012
    This totally needs to be fixed.  Like the above commenter, I am trying to use the WCF Test Client and BizTalk at the same time.

  • Anonymous
    February 22, 2015
    Believe me , if you have report error: “The contract ‘IMetadataExchange’ in client configuration does not match the name in service contract…”. Search this string in whole project and remove it : , ReplyAction="*"

  • Anonymous
    April 14, 2015
    You can also remove the binding in machine.config in your own web service file. <client>      <remove contract="IMetadataExchange" name="mssql" />      <remove contract="IMetadataExchange" name="sap" />      <remove contract="IMetadataExchange" name="oracledb" />      <remove contract="IMetadataExchange" name="oracleebs" />    </client> This way you don't have to keep changing your machine.config when using different applications