Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Unable to access WCF service using NET.TCP binding

I already asked a similar question here: Unable to add service client for a net.tcp WCF service. The problem was solved at that time. But now the same error is coming up. My configuration of WCF service is same as that of previous question. I am again posting it here:

<system.serviceModel>
    <services>
      <service name="CoreService.Service1" behaviorConfiguration="beh1">
        <host>
          <baseAddresses>
            <add baseAddress="net.tcp://localhost/Service1.svc/mex" />
          </baseAddresses>
        </host>
        <endpoint
     binding="netTcpBinding"
     bindingConfiguration="ultra"
     contract="CoreService.IAccountService"/>
        <endpoint
      binding="netTcpBinding"
      bindingConfiguration="ultra"
      contract="CoreService.IBoardService"/>
        <endpoint
      binding="netTcpBinding"
      bindingConfiguration="ultra"
      contract="CoreService.ICategoryService"/>

        <endpoint
                address="mex"
                binding="mexTcpBinding"
                contract="IMetadataExchange"/>
      </service>
    </services>
    <bindings>
      <netTcpBinding>
        <binding name="ultra"
             maxBufferPoolSize="2147483647"
             maxBufferSize="2147483647"
             maxReceivedMessageSize="2147483647"
             portSharingEnabled="false"
             transactionFlow="false"
             listenBacklog="2147483647"
             sendTimeout="00:01:00">
          <security mode="None">
            <message clientCredentialType="None"/>
            <transport protectionLevel="None" clientCredentialType="None"/>
          </security>
          <reliableSession enabled="false"/>
        </binding>
      </netTcpBinding>
    </bindings>
    <behaviors>
      <serviceBehaviors>
        <behavior name="beh1">
          <serviceMetadata httpGetEnabled="false" />
          <serviceDebug includeExceptionDetailInFaults="True" />
          <dataContractSerializer maxItemsInObjectGraph="65536" />
        </behavior>
      </serviceBehaviors>
    </behaviors>
  </system.serviceModel>

The error is:

The URI prefix is not recognized. Metadata contains a reference that cannot be resolved: 'net.tcp://localhost/Service1.svc'. Could not connect to net.tcp://localhost/Service1.svc. The connection attempt lasted for a time span of 00:00:02.0051147. TCP error code 10061: No connection could be made because the target machine actively refused it 127.0.0.1:808. No connection could be made because the target machine actively refused it 127.0.0.1:808 If the service is defined in the current solution, try building the solution and adding the service reference again.

After the problem was solved, I didn't made any changes to the configuration and after some days it started showing that error again. I tried everything but nothing worked. Please help!

UPDATE: I am also able to access it using HTTP through my browser but unable to access using "Add Service Reference" option through net.tcp protocol.

like image 222
Aishwarya Shiva Avatar asked Mar 21 '14 15:03

Aishwarya Shiva


People also ask

What is Net TCP binding WCF?

This binding generates a run-time communication stack by default, which uses transport security, TCP for message delivery, and a binary message encoding. This binding is an appropriate Windows Communication Foundation (WCF) system-provided choice for communicating over an Intranet.

What is Net TCP binding?

The NetTcpBinding uses TCP connection pooling based on the service's host DNS name and the port number the service is listening on. This works well when a client makes calls to different services on different ports, or services are hosted in a single process and share a port.

How to enable net tcp in IIS?

Open IIS=> in Connections panel=> expand Sites=>Select your website=>Go to Right site Action Pane=> click on Advanced Settings=> Expand the 'Behavior' section In the field 'Enable Protocols' set these below values by commas, (http,net. tcp,net.


1 Answers

Finally with the help of this link: http://rohitguptablog.wordpress.com/2011/06/16/configuring-wcf-service-with-nettcpbinding/, I figured out what was going wrong. Actually I missed the third step in above link. The Net.Tcp services were not running.

enter image description here

like image 95
Aishwarya Shiva Avatar answered Oct 12 '22 07:10

Aishwarya Shiva