title: Hosting nettcp WCF service in IIS7 fails
body: <p>Ok, so I have a really simple WCF service that I would like to host under IIS. I have enabled the "Windows Communication Foundation Non-Http Activation" so that is not the problem. I am running IIS 7,5 on a Windows 7 computer with .NET 4.0 installed. My web.config looks like this:</p>
  
  <pre><code>&lt;?xml version="1.0"?&gt;
  &lt;configuration&gt;
    &lt;system.serviceModel&gt;
      &lt;services&gt;
        &lt;service name="FirstWcfService.Service" behaviorConfiguration="ServiceBehavior"&gt;
          &lt;!-- Service Endpoints --&gt;
          &lt;endpoint address="" binding="netTcpBinding" contract="NetTcpServiceTest.IMySuperService"
              bindingConfiguration="tcpbinding"/&gt;
          &lt;endpoint address="mextcp" binding="mexTcpBinding" contract="IMetadataExchange"/&gt;
        &lt;/service&gt;
      &lt;/services&gt;
      &lt;behaviors&gt;
        &lt;serviceBehaviors&gt;
          &lt;behavior name="ServiceBehavior"&gt;
            &lt;!-- To avoid disclosing metadata information, set the value below to false
                and remove the metadata endpoint above before deployment --&gt;
            &lt;serviceMetadata httpGetEnabled="true"/&gt;
            &lt;!-- To receive exception details in faults for debugging purposes,
                 set the value below to true.  Set to false before deployment to avoid
                 disclosing exception information --&gt;
            &lt;serviceDebug includeExceptionDetailInFaults="false"/&gt;
          &lt;/behavior&gt;
        &lt;/serviceBehaviors&gt;
      &lt;/behaviors&gt;
      &lt;bindings&gt;
        &lt;netTcpBinding&gt;
          &lt;binding name="tcpbinding" portSharingEnabled="true"&gt;
            &lt;!--&lt;security mode="None"&gt;&lt;/security&gt;--&gt;
            &lt;security mode="Transport"&gt;
              &lt;transport clientCredentialType="Windows" protectionLevel="EncryptAndSign"/&gt;
              &lt;message clientCredentialType="Windows"/&gt;
            &lt;/security&gt;
          &lt;/binding&gt;
          &lt;binding name="mexTcpBinding" portSharingEnabled="true"&gt;
            &lt;security mode="None" /&gt;
          &lt;/binding&gt;
        &lt;/netTcpBinding&gt;
      &lt;/bindings&gt;
    &lt;/system.serviceModel&gt;
  &lt;/configuration&gt;
  </code></pre>
  
  <p>The service is hosted as an application called "NetTcpServiceTest" under the default web site in IIS. When I try to add a reference to net.tcp://localhost/NetTcpServiceTest/MySuperService.svc/mextcp in visual studio I get the following error:</p>
  
  <pre><code>Metadata contains a reference that cannot be resolved: 'net.tcp://localhost/NetTcpServiceTest/MySuperService.svc/mextcp'.
  The message could not be dispatched because the service at the endpoint address 'net.tcp://localhost/NetTcpServiceTest/MySuperService.svc/mextcp' is unavailable for the protocol of the address.
  If the service is defined in the current solution, try building the solution and adding the service reference again.
  </code></pre>
  
  <p>And the error in the event log is:</p>
  
  <pre><code>An error occurred while trying to listen for the URL '/LM/W3SVC/1/ROOT/NetTcpServiceTest'. This worker process will be terminated.
   Sender Information: net.tcp
   Exception: System.ServiceModel.WasHosting.TcpAppDomainProtocolHandler/65824025
   Process Name: System.ServiceModel.CommunicationException: The TransportManager failed to listen on the supplied URI using the NetTcpPortSharing service: .
  </code></pre>
  
  <p>I have also enabled the binding for the site and application. Does anyone know how to solve this? When I search for it on internet the only answer I found was to re-install IIS and .NET, but that doesn't sounds like a real solution for me.</p>