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.
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.
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.
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.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With