Friday, April 20, 2012

Microsoft WCF Test Client error after installing BizTalk Service SDK

Ever since adding a bunch of BizTalk stuff to my development machine, I’ve had a (admittedly) small problem with the WCF test client (wcftestclient.exe).
Every time I added a new service, I got this error:

Or for you robots:
---------------------------
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  
---------------------------
Mind you, after pressing ok wcftestclient worked just fine, except for this error in the UI:















Today I finally got time to fix the problem. A bit of Googling let me to this post:
Stating both the cause of the problem (installing the BizTalk Services SDK) and (almost) the solution to my problem.
However, I didn’t find the section mentioned in the post, but in my 32-bit framework 4 machine.config:
C:\Windows\Microsoft.NET\Framework\v4.0.30319\Config\machine.config
I found this section:
<client>
       <endpoint binding="sqlBinding" contract="IMetadataExchange" name="mssql"/>
       <metadata>
              <policyImporters>
                     <extension … />
              </policyImporters>
              <wsdlImporters>
                     <extension … />
              </wsdlImporters>
       </metadata>
</client>

Comment this out and you are good to go (at least while not using the SDK) :

Wednesday, April 18, 2012

Trouble getting a net.tcp endpoint of a WCF service up and running

Today I had some trouble getting the net.tcp endpoint of a WCF service up and running. HTTP was working just fine, but trying to access the net.tcp endpoint I kept getting this error:

The message could not be dispatched because the service at the endpoint address 'net.tcp://[host]/[service].svc' is unavailable for the protocol of the address.

I tried everything: checked my net.tcp configuration, restarted IIS and the Net.Tcp Listener Adapter at least a couple of times. Nothing worked.

Luckily, a bit of Googling let me to this post:


Which (of course) suggested that I had a look at my servers event log. This showed a bunch of errors like this:

An error occurred while trying to start an app domain protocol listener channel.

Exception: System.Web.HttpException

Message: Server cannot access application directory '[SOME MISSING FOLDER]'. The directory does not exist or is not accessible because of security settings.

The reason being that the web server had a couple of web sites pointing to non-existing folders. Removing these I got another error, but after restarting IIS (and thereby also the Net.Tcp Listener Adapter) everything worked just perfectly.