Search code examples
c#asp.netwcfiisnettcpbinding

How to add service reference in visual studio with nettcpbinding hosted in IIS?


enter image description here

I have configured wcf service in IIS. my web.config is

<services>
<service name="DNExpWCFService.Service1"        
behaviorConfiguration="DNExpWCFServiceBehaviour">
<endpoint name="WSGetEmployee" address="/WSGetEmployee"                       
binding="wsHttpBinding" contract="DNExpWCFService.IService1">
</endpoint>
<endpoint address="mex" binding="mexHttpBinding"
contract="IMetadataExchange"></endpoint>
</service>
</services>

Now when I add service reference using http://localhost:8333/Service1.svc it works fine. But for nettcpbinding I can't add service reference. I tried using net.tcp://localhost:8444/Service1.svc. But it also fails. How to add service reference using nettcpbinding?


Solution

  • To add service reference mex (IMetadataExchange) endpoint is used. Try to add mex endpoint with binding="mexTcpBinding"