.net – IIS 7.0 using netTcpBinding

iis-7nettcpwcf

I've been trying for more than a week without any success at all, to host wcf service using netTcpBinding.

With http, everything is ok. But with tcp problems arise.

I have performed all the steps I'm supposed to, in order to host my service in WAS:

.Net 3.0 Features are enabled, including http and non-http Activation

. At IIS Manager/ Manage Web Site / Advanced Settings, both, http and net.tcp protocols are enabled.
-I also add net tcp to site binding

When i run the webservice, i have this exception : Could not find a base address that matches scheme net.tcp for the endpoint with binding NetTcpBinding. Registered base address schemes are [http].

Here's what my Web.Config looks like:

   <services>
        <service name="Services.Library.OrderService"  BehaviorConfiguration="OrderServiceBehavior">
            <!-- Service Endpoints -->
            <endpoint  address="WSOrder.svc" 
                        binding="netTcpBinding"
                        bindingConfiguration="netTcpStreaming"
                        name="NetTcpBindingEndpoint"
                        contract="Services.Interface.IOrderService" >


                <identity>
        <dns value="localhost" />
      </identity>

            </endpoint>

            <endpoint address="mex" binding="mexTcpBinding" contract="IMetadataExchange"/>

            <host>
                <baseAddresses>
                    <add baseAddress="net.tcp://localhost:808/" />                  
                </baseAddresses>
            </host>


        </service>
    </services>

    <behaviors>
        <serviceBehaviors>
            <behavior name="OrderServiceBehavior">
                <!-- To avoid disclosing metadata information, set the value below to false and remove the metadata endpoint above before deployment -->
                <serviceMetadata httpGetEnabled="false" />
                <!-- 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 -->
                <serviceDebug includeExceptionDetailInFaults="false" />
                <dataContractSerializer maxItemsInObjectGraph="6553600" />
            </behavior>
        </serviceBehaviors>
    </behaviors>

    <bindings>
        <netTcpBinding>
            <binding name="netTcpStreaming"
                     openTimeout="10:00:00"
                     closeTimeout="10:00:00" 
                     receiveTimeout="10:00:00"
                     sendTimeout="10:00:00"
                     maxBufferSize="2147483647" maxBufferPoolSize="2147483647" maxReceivedMessageSize="2147483647" >

                <!-- this is for demo only. Https/Transport security is recommended -->
                <security mode="None" />
            </binding>
         </netTcpBinding>

    </bindings>

Can you tell me please what is wrong with my code?

Thanks in advance

Best Answer

If you want mex, you have to have an http endpoint defined whether you use it or not.

drop the mex and your service should work just fine.

here is a working net.tcp binding from one of my integration tests.... compare it to what you have..

<?xml version="1.0" encoding="utf-8" ?>
<configuration>
 <system.serviceModel>
    <behaviors>
      <serviceBehaviors>
        <behavior name="MyServiceBehavior">
          <serviceDebug includeExceptionDetailInFaults="true"/>
        </behavior>
      </serviceBehaviors>
    </behaviors>
    <services>
      <service name="WcfServiceLibrary1.Service">
        <endpoint address="service" binding="netTcpBinding" contract="WcfServiceShared.IService" name="TcpBinding" />
        <host>
          <baseAddresses>
            <add baseAddress="net.tcp://localhost:8000/ServiceHost/" />
          </baseAddresses>
        </host>
      </service>
    </services>
  </system.serviceModel>
</configuration>
Related Topic