It really bothers me for hours. I created the simplest WCF service using TCP binding.
namespace WcfTcpService { public class TestTcpService : ITestTcpService { public string Hello(string name) { return "Hello, " + name + "!"; } } } namespace WcfTcpService { [ServiceContract] public interface ITestTcpService { [OperationContract] string Hello(string name); } }
The Web.config file has the following section:
<system.serviceModel> <services> <service name="WcfTcpService.TestTcpService" behaviorConfiguration="TestServiceBehavior"> <host> <baseAddresses> <add baseAddress="net.tcp://localhost:808/WcfTcpService.TestTcpService" /> </baseAddresses> </host> <endpoint address="" binding="netTcpBinding" bindingConfiguration="tcpBinding" contract="WcfTcpService.ITestTcpService"></endpoint> <endpoint address="mex" binding="mexTcpBinding" bindingConfiguration="" contract="IMetadataExchange"></endpoint> </service> </services> <bindings> <netTcpBinding> <binding name="tcpBinding" portSharingEnabled="true"> <security mode="None"></security> </binding> </netTcpBinding> </bindings> <behaviors> <serviceBehaviors> <behavior name="TestServiceBehavior"> <serviceMetadata httpGetEnabled="true" httpsGetEnabled="true"/> <serviceDebug includeExceptionDetailInFaults="false"/> </behavior> </serviceBehaviors> </behaviors> </system.serviceModel>
This service is hosted on IIS:

Now, when you try to add a link to net.tcp://localhost:808/WcfTcpService.TestTcpService from the client application, I keep getting the error:
The URI prefix is not recognized. Metadata contains a reference that cannot be resolved: 'net.tcp://localhost/WcfTcpService.TestTcpService'. The message could not be dispatched because the service at the endpoint address 'net.tcp://localhost/WcfTcpService.TestTcpService' is unavailable for the protocol of the address. If the service is defined in the current solution, try building the solution and adding the service reference again.
The net.tcp service is running, I get the same error with WcfTestClient.exe. and I can successfully run http://localhost/WcfTcpService/TestTcpService.svc .
I searched google but nothing came up.
Thanks!
EDIT:
The default Web site bindings screen is as follows:

source share