7

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

With http, everything is ok. I can access my service even from a remote machine. 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

  • I have granted 'Network Service' and 'IIS_IUSRS' the following permissions to the folder containing the site:

    • Read & Execute
    • List Folder Contents
    • Read
  • Opened de ports 8100 and 8086 in the firewall.

  • At IIS Manager/ Actions / Bindings the following bindings are set up:

    • http 8100:*
    • net.tcp 8086:*
  • At IIS Manager/ Manage Web Site / Advanced Settings, both, http and net.tcp protocols are enabled.

The original problem I had was that I was able to reach the service via http but when trying with tcp I got the following error:

"The message could not be dispatched because de service at the endpoint addres 'net.tcp://myDomain/HelloWorld.Hello.svc' is unavailable for the protocol address."

I found a post in this site whose author had the same problem and It was solved by reinstalling .net 3.0 features. So I tryed that. I also tryed to reinstall IIS 7.0 just in case. Now, the situation is worse than it was at the begining. If I configure an endpoint with tcpBinding in my Web.Config I can't even reach my service at it's http address using IE!! I get the following message:

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

The Web.Config file is as follows:


       name="HelloWorld.Hello">
       <host>
          <baseAddresses>
             <add baseAddress="http://myDomain:8100/HelloWorld/" />
         <add baseAddress="net.tcp://myDomain:8086/HelloWorld/" />
          </baseAddresses>
       </host>          

       <endpoint address=""
                 binding="wsHttpBinding"
                 contract="HelloWorld.IHello"
                 bindingConfiguration="httpInseguro">
       </endpoint>

       <endpoint address=""
                 binding="netTcpBinding"
                 contract="HelloWorld.IHello"
                 bindingConfiguration="netTcpInseguro">
       </endpoint>


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

    </service>
 </services>

<bindings>

  <wsHttpBinding>
    <binding name ="httpInseguro">
      <security mode ="None" />
    </binding>        
  </wsHttpBinding>

  <netTcpBinding>
    <binding name ="netTcpInseguro">
      <security mode ="None" />
    </binding>        
  </netTcpBinding>

</bindings>

and the .svc file is like this:

Could anyone please give me a clue about what's going on? I really don't know what else to do. This is being a real headacke becasuse using http binding is not an option. Thanks in advance.

Gonzalo Méndez
  • 548
  • 7
  • 18
  • What version of .NET are you running? – John Saunders Jul 09 '09 at 18:58
  • Hi John, It's .net 3.5. Regards. – Gonzalo Méndez Jul 17 '09 at 14:48
  • I'm having the same trouble. What did you added to your config file to make it work? –  Jan 22 '10 at 17:38
  • Hi Luiz, Unfortunatelly, we're not running owr service using netTcpBinding anymore since a few months ago, so I don't have the configuration file that finally worked at that time. However, Marc's answer above helped at that time I recall. One thing for sure, I had to check several sites on the internet to figure it out. I couldn't find the complete procedure in a single site. Best wishes, Gonzalo – Gonzalo Méndez Jan 23 '10 at 14:10
  • Thanks Gonzalo, I will continue looking and trying. I have already tried lots of different suggestions up to the time. –  Jan 26 '10 at 11:26

2 Answers2

3

You'll need to enable the TCP hosting in WAS by calling appcmd.exe:

%windir%\system32\inetsrv\appcmd.exe set site 
    "Default Web Site" -+bindings.[protocol='net.tcp',bindingInformation='*']

Check out the MSDN documenation or Michele Leroux Bustamante's article on this topic - it contains all the info you'll need.

Marc

marc_s
  • 732,580
  • 175
  • 1,330
  • 1,459
  • 1
    you can also do this via the IIS7 Gui. Go to your site -> edit bindings and add the net.tcp binding with the corresponding port:* – donnovan9 Feb 26 '10 at 15:12
  • +1 from me @marc plus more if possible! I did notice that in my environment I needed to specify the binding information as '808:*' perhaps this should be edited into your answer? Also found that having the incorrect '*' broke things. I needed to remove it before this would work. Thanks again, saved my day! – David Hall Mar 24 '10 at 03:22
1

Thnak you for your answer and for the links. I'll check them. I forgot to tell but I had already enable TCP hosting on was. Someone suggested me to add this to the config file:

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

And now it's working ok. Best regards,

Gonzalo

marc_s
  • 732,580
  • 175
  • 1,330
  • 1,459
Gonzalo Méndez
  • 548
  • 7
  • 18