Click here to Skip to main content
14,738,277 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
I have a simple WCF service with GetData() method. I am using netTcp binding for the same. My service app.config is like this:

      <messageLogging logEntireMessage="true" logMalformedMessages="true"

        logMessagesAtTransportLevel="true" />
      <service name="LeastPrivilege.CustomPrincipalService" behaviorConfiguration="Behavior">
            <add baseAddress="net.tcp://localhost:9001/Services"/>

        <endpoint name="CustomPrincipalService" binding="netTcpBinding" contract="LeastPrivilege.IService" bindingConfiguration="NetTcpBindingConfig"/>
        <endpoint address="mex" binding="mexTcpBinding" contract="IMetadataExchange" />  

        <binding name="NetTcpBindingConfig">
          <security mode="Transport">
            <transport clientCredentialType="Windows"/>
            <message clientCredentialType="Windows" algorithmSuite="Default" />

        <behavior name="Behavior">
          <serviceMetadata httpGetEnabled="false"/>
          <serviceDebug includeExceptionDetailInFaults="false"/>
          <serviceAuthorization principalPermissionMode="Custom">
              <add policyType="LeastPrivilege.CombinedRolesPolicy, CustomPrincipalService"/>

I am able to host the service successfully. But, when I am trying to add the service reference from the client I am getting the below error:

The URI prefix is not recognized.
Metadata contains a reference that cannot be resolved: 'net.tcp://localhost:9001/Services'.
The socket connection was aborted. This could be caused by an error processing your message or a receive timeout being exceeded by the remote host, or an underlying network resource issue. Local socket timeout was '00:05:00'.
An existing connection was forcibly closed by the remote host
If the service is defined in the current solution, try building the solution and adding the service reference again.

Please help.

What I have tried:

I tried the same configuration with wsHttpBinding with some changes like httpGetEnabled = true and all and I was able to get the service reference in my client using wsHttpBinding. But, it is not working with netTcp binding.
Updated 18-May-16 22:22pm

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900