tags:

views:

831

answers:

4

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

A: 

This is totally a guess but you may want to try futzing with this code:

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

Maybe change net.tcp to http

Joe Philllips
A: 

I've been having similar issues myself recently, but eventually managed to get things working.

You say "At IIS Manager/ Manage Web Site / Advanced Settings, both, http and net.tcp protocols are enabled. -I also add net tcp to site binding". This setting also needs to be manually set at the sub "virtual root" level if there is one. Is this running under a virtual root in IIS? If so, check this setting there.

Have you also set the bindings at the web site level "edit bindings"? You'll need to add a net.tcp binding here. In your case:

Type: net.tcp
Binding Information: 808:*

If both of those fail, post back. I'll keep an eye out :)

[Edit in response to your comments]

OK - I've had a closer look at your config and it doesn't look right to me. This is the server side config? [ie not for a calling client]

I've recreated a config, based on yours, for you to experiment with. [I've stripped out the mex stuff - just a barebones tcp binding]

Have you been using the WCF Service Configuration Editor to generate this config, or have you been doing it by hand? If by hand, don't - use the config editor. It saves lives!

<?xml version="1.0" encoding="utf-8" ?>
<configuration>
  <system.serviceModel>
    <bindings>
      <netTcpBinding>
        <binding name="netTcpStreaming" closeTimeout="00:10:00" openTimeout="00:10:00"
            sendTimeout="00:10:00" maxBufferPoolSize="2147483647" maxBufferSize="2147483647"
            maxReceivedMessageSize="2147483647">
          <security mode="None" />
        </binding>
      </netTcpBinding>
    </bindings>
    <services>
      <service name="Services.Library.OrderService">
        <endpoint address="net.tcp://localhost:808/" binding="netTcpBinding"
          bindingConfiguration="netTcpStreaming" contract="Services.Interface.IOrderService" />
        <host>
          <baseAddresses>
            <add baseAddress="net.tcp://localhost:808/" />
          </baseAddresses>
        </host>
      </service>
    </services>
  </system.serviceModel>
</configuration>
Rob Levine
thank you for your answer;1. it is not over a virtual directory 2. I already add a net.tcp binding like bellow : Type: net.tcpBinding Information: 808:*:(
im sorry but i dont see any difference between this config and my config, what did u change exactly? i notice that there is no base address nor mex endpoint in your config, which are recomended. infact, this is server config, generetad by config editor first, but i added information concerning my wcf by hand, like nettcpbinding, endpoint, baseadress etc...
@user275384: you need to shift to "Something is wrong and I don't know what. Maybe I should try listening to the people that are helping me." mode. You should try either one of these bindings and see if it works for you. THEN start adding. simple. I am probably done with this question. See you next time.
Sky Sanders
I didn't change anything directly, I just transcribed your settings into a clean config file using the config editor, cutting it down to the bare minimum. I did miss out the baseAddresses, which I've added back in. Do you still get the same error when you try this config?
Rob Levine
A: 

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>
Sky Sanders
i drop it but it doesnt work
@user275384: did you also drop the serviceMetadata element? and you might want to better format the xml. that is proper SO manners.
Sky Sanders
did u mean this one : <serviceMetadata httpGetEnabled="false" />i drop it also, but still same problem
A: 

thank you for your answer;

  1. it is not over a virtual directory

  2. I already add a net.tcp binding like bellow :

Type: net.tcp Binding Information: 808:*

:(

see amended answer below :)
Rob Levine
-1, this doesnt answer the question.
mizipzor