Wcf – IIS-hosted WCF service with net.tcp binding unreachable

.net-4.0iis-7.5net.tcpwcf

I'm trying to host a WCF service with net.tcp binding within an IIS 7.5 site on Windows 7, 64-bit. Sadly, the service is unreachable. In fact, opening a connection to the TCP port using telnet even fails.

Here's what my system.serviceModel section of the web.config for the site looks like:

<system.serviceModel>
    <behaviors>
      <serviceBehaviors>
        <behavior name="DefaultServiceBehavior">
          <serviceMetadata httpGetEnabled="false" />
          <serviceDebug includeExceptionDetailInFaults="true" />
          <dataContractSerializer maxItemsInObjectGraph="2000000" />
        </behavior>
      </serviceBehaviors>
    </behaviors>
    <services>
      <service behaviorConfiguration="DefaultServiceBehavior" 
               name="FooService">
        <endpoint binding="netTcpBinding" bindingConfiguration="service" 
                  name="service" contract="IFoo" />
        <endpoint binding="mexTcpBinding" 
                  bindingConfiguration="DuplexBinding" contract="IFoo" />
        <host>
          <baseAddresses>
            <add baseAddress="net.tcp://127.0.0.1:9000/service"/>
          </baseAddresses>
        </host>
      </service>
    </services>
    <bindings>
      <netTcpBinding>
        <binding name="service" portSharingEnabled="true">
          <readerQuotas maxDepth="32" maxStringContentLength="8192" 
                        maxArrayLength="16384" maxBytesPerRead="4096" 
                        maxNameTableCharCount="16384" />
          <security mode="None"/>
        </binding>
        <binding name="DuplexBinding">
          <reliableSession enabled="true"/>
          <security mode="None"/>
        </binding>
      </netTcpBinding>
    </bindings>
</system.serviceModel>

In IIS Manager, I set up a site with an App Pool running under the identity of NETWORK SERVICE, with the v4.0 .NET Framework and an integrated pipeline. There is one binding for the site with a type of net.tcp and "Binding Information" set to 9000:*.

Under my computer's services, I started the previously stopped "Net.Tcp Listener Adapter" and "Net.Tcp Port Sharing Service" services and made them both start up automatically. I also ensured that "Windows Communication Foundation Non-HTTP Activation" was installed.

What else do I have to do to get IIS/WCF/WAS/whatever to listen on port 9000 so my service can be activated and invoked?

My question is similar to Host WCF service with net.tcp binding through IIS Manager 7.5, but the OP was not registered, and his question was not answered. I'm opening this question so I can post my own details.

Update

I've found some additional clues. I decided to add a second binding so I can work with HTTP bindings while trying to figure out the net.tcp issues. Now, when I try to access the HTTP endpoint, I get this error

Could not find a base address that matches scheme net.tcp for the endpoint with binding NetTcpBinding. Registered base address schemes are [http]

I very clearly have bindings for both HTTP and net.tcp here:

<baseAddresses>
    <add baseAddress="net.tcp://localhost:9000/"/>
    <add baseAddress="http://localhost:8050/"/>
</baseAddresses>

So the phrase "Registered base address schemes" has me worried; is there something additional I have to do to allow my site to support the net.tcp scheme?

Best Answer

I finally got IIS to allow connections to port 9000. I didn't see this option before, but I don't know if that's because I failed my spot check or if I had to do something to get it to show up.

Under the advanced settings of the IIS site, there is an "Enabled Protocols" setting. Previously, it was set to just http. After changing it to http, net.tcp, I can connect to the TCP port.

Related Topic