2
votes

I'm trying to get my WCF service working with netTcpBinding instead of wsHttpBinding, but I can't seem to get it working.

I added the net.tcp binding to IIS7.5 but the status is Unknown (and when I also remove the http binding it puts a big red X through the site and I have to add a new http binding before I can access any settings again). I already looked here and on Google but I could only find two or three posts about this issue without any true solutions.

What I have:

  • WAS service running, and also the Net.* services.
  • Added net.tcp in Advanced Settings in IIS.
  • WCF non-http is installed.

There seems to be a TCP listener running, as it shows in netstat that it is listening on my specified port: 809) and I also got firewall message (also tried disabling the firewall/antivirus, but it didn't help).

WCF Test Client results in this error:

Error: Cannot obtain Metadata from net.tcp://localhost:809/MyService.svc

My Web.config (as copied mostly from MSDN, for proper layout look here http://pastebin.com/Ru8p0T9N):

<services>
  <service behaviorConfiguration="MyBehavior" name="WCFService.MyService">
    <endpoint address="" binding="netTcpBinding" bindingConfiguration="Binding1" name="MyServiceEndpoint" contract="WCFService.MyService">
      <identity>
        <dns value="localhost" />
      </identity>
    </endpoint>
    <endpoint address="mex" binding="mexTcpBinding" bindingConfiguration="" name="MyServiceMexTcpBidingEndpoint" contract="IMetadataExchange" />
    <host>
      <baseAddresses>
        <add baseAddress="net.tcp://localhost:809/MyService.svc" />
      </baseAddresses>
    </host>
  </service>
</services>
<behavior name="MyBehavior">
  <serviceMetadata httpGetEnabled="false" />
  <serviceDebug includeExceptionDetailInFaults="true" />
</behavior>
<netTcpBinding>
  <binding name="Binding1"hostNameComparisonMode="StrongWildcard"sendTimeout="00:10:00"maxReceivedMessageSize="65536"transferMode="Buffered"portSharingEnabled="true">
    <security mode="Message">
      <transport clientCredentialType="None" />
      <message clientCredentialType="None" />
    </security>
  </binding>
</netTcpBinding> 

Everything works fine with wsHttpBinding but not with net.tcp. I tried several different settings in the Web.config from multiple sources but I keep ending up with the same problem.

2
Have you verified all the kinks in the article below:codegain.com/articles/wcf/howto/…AvkashChauhan
Thanks for the link, I put application pool on classic mode (didn't have that before), but still the same error.The Cookies Dog

2 Answers

1
votes

Did you add net.tcp as an Enabled Protocol in IIS? Manage website => advanced settings => enabled protocols (comma delimited)

0
votes

For people having the same problem: As I said before, I changed the Application Pool to Classic and it didn't work (http also didn't work anymore), but when I changed it back and recycled application pool it suddenly worked.