Test WCF Service from the MEX binding for NamedPipe Connection

Test WCF Service from the MEX binding for NamedPipe Connection

It when into the trouble when, there was requirement to change the WCF binding from TCP to NamedPipe for one of the project

The problem was, there were two WebSites, which were hosting the WCF Service. One service in each one of the website.

Now, as for the TCP Binding, website where separated by the port number. So, base address was something like



But, when doing for the NamedPipe, there aren’t port numbers in NamedPipe. So, it needed to have scheme like net.pipe://{someuniquename}/Service1.svc

But, the problem was, service was hosted in the WAS under IIS. I have no control on the addresses, as it would be dictated by the IIS

View my last post, which mention how to enter IIS binding Information to get unique hostname for namedpipe configuration

Now, I have added ABC and DEF in the binding information for each site. Now, my namedpipe endpoint address where



Now, I have my Server side, Host Endpoint as following

   1: <service name="ABC.Service.AuthenticationGateway.ContentAccessService"                     

   2:               behaviorConfiguration="ABC.ServiceHost.ServiceBehavior">                    

   3:        <host>                    

   4:          <baseAddresses>                    

   5:            <add baseAddress = "net.pipe://localhost/" />                    

   6:          </baseAddresses>                    

   7:        </host>                    

   8:        <endpoint address="ContectAccessService"


  10:                  binding="netNamedPipeBinding"

  11:                  bindingConfiguration="NetPipeBinding_IContectAccessService"

  12:                  contract="ABC.Service.AuthenticationGateway.IContectAccessService" />


  14:        <endpoint address="mex" binding="mexNamedPipeBinding" contract="IMetadataExchange" /> 

  15: </service>

Now, here relative address is ContectAccessService. So, my absolute url would be net.pipe://ABC/Service1.svc/ContectAccessSerice.

This is the browse the url for svc file in the url, you can see the wsdl for the service. Mine address was http://localhost:62/Service1.svc?wsdl. Mine, Website was hosted on 62 port.

Doing that, I need to test my Namedpipe service. I was using WCFTestClient, which is under C:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\IDE. Replace yellow part which wherever you have installed Visual Studio. 10.0 would be replaced by version for 2010/2012/2013. For VS 2010, it’s 10.0.

I was trying to address in pink in WcfTestClient.exe add service dialog

Doing so, I use to get the error

Error: Cannot obtain Metadata from net.pipe://ABC/Service1.svc/ContectAccessService If this is a Windows (R) Communication Foundation service to which you have access, please check that you have enabled metadata publishing at the specified address. For help enabling metadata publishing, please refer to the MSDN documentation at http://go.microsoft.com/fwlink/?LinkId=65455.WS-Metadata Exchange Error URI: net.pipe://ABC/Service1.svc/ContectAccessService Metadata contains a reference that cannot be resolved: ‘ net.pipe://ABC/Service1.svc/ContectAccessService ‘. <?xml version=”1.0″ encoding=”utf-16″?><Fault xmlns=”http://www.w3.org/2003/05/soap-envelope”><Code><Value>Sender</Value><Subcode><Value xmlns:a=”http://www.w3.org/2005/08/addressing”>a:ActionNotSupported</Value></Subcode></Code><Reason><Text xml:lang=”en-US”>The message with Action ‘http://schemas.xmlsoap.org/ws/2004/09/transfer/Get&#8217; cannot be processed at the receiver, due to a ContractFilter mismatch at the EndpointDispatcher. This may be because of either a contract mismatch (mismatched Actions between sender and receiver) or a binding/security mismatch between the sender and the receiver. Check that sender and receiver have the same contract and the same binding (including security requirements, e.g. Message, Transport, None).</Text></Reason></Fault>

I was baffled and perplex by the error. There is already, mex binding expose, then, why isn’t the ‘WCF client’ can’t get the metaexchange data?

It found, that error was silly from my side. The address which need to input in WCF Test Client was net.pipe://ABC/Service.svc     instead of


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 )

Google photo

You are commenting using your Google 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 )

Connecting to %s