none
WCF Net.Tcp Binding question RRS feed

  • Question

  • Hi. First off, I am not a developer. I am responsible for aserver that hosts WCF web services.

    My issue...

    I have configured a web root with a Net.Tcp binding. The Net.Tcp and Port Sharing services are enabled. The goal is to bind the listener to a specific IP address, rather than all (0.0.0.0). The only way I am able to successfully do this is by using the IP address in the binding information, like this:

        8301:192.168.2.100

    When configured like this, I can see that the listener is only on 192.168.2.100:8301 by running netstat.exe, which is what I want. When I configure it like either two of these examples, it listens on 0.0.0.0, which I do not want.

        8301:*
        8301:myserver

    The problem is that the developer's code can only successfully access the service by using the IP address when the IP address is specified in the binding (net.ctp://192.168.2.100/Myservice). The application cannot connect to the service using a host name, net.tcp://myserver/Myservice. It returns this error:

    "There was no endpoint listening at net.tcp://myserver:8301/MyService.svc that could accept the message. This is often caused by an incorrect address or SOAP action."

    We are having a hard time finding out much information about WCF Net.Tcp, so any help is appreciated.
    Friday, December 12, 2008 9:07 PM

All replies

  • Bump...since this posted late Friday
    Thanks
    Monday, December 15, 2008 3:50 PM
  • Hi Brandon,

    I think it's probably the problem of the way you host your wcf service. Can you show me how you hosting your service and let's see what's going on there.

    cheers
    Binze
    Wednesday, December 17, 2008 2:19 AM
  • I am not completely sure of what you mean by showing you how the service is hosted. We have a top-level IIS application/site with about 6 individual application roots created beneath. All of these applications use a single app pool. The top-level site is currently bound to http and net.tcp (eventually the http binding will be dropped). The binding information for net.tcp is currently 8301:192.168.2.100. Each application root hosts several .svc web services.

    Let me know what other info you are looking for. If you are looking for code, I will not be able to post that.
    Wednesday, December 17, 2008 2:18 PM
  •  Hi Brandon,
    My point is I am not sure about how you hosted your WCF web services. As you mentioned you you have a top-level IIS application/site, my understanding is that you hosted your wcf web services in iis server. In this case I think there is an conflict, because IIS server doesn't support  netTcpBinding. It will only support HttpBinding(basicHttpBinding or wsHttpBinding).

    Secondly you described that the developer's code can only successfully access the service by using the IP address when the IP address is specified in the binding (net.ctp://192.168.2.100/Myservice). The application cannot connect to the service using a host name, net.tcp://myserver/Myservice. I assume this might be referring to DNS problem.

    Also I don't quite understand why you've got the ip like 0.0.0.0, if you host you WCF service on the iis or WAS or self hosted, your server maching can only have one ip address such as 192.168.2.100. Therefore I need you let me see how your web.configs have been configured on both server and client side if you can do this please.

    good luck
    Binze
    Thursday, December 18, 2008 9:37 AM
  • Yes, the WCF service is being hosted in IIS 7. I used appcmd to add the net.tcp binding and to enable the protocol for the application.

    appcmd set site "MySite" /+bindings.[protocol='net.tcp',bindingInformation='8301:192.168.2.100']
    appcmd set app "MySite/MyApp" /enabledProtocols:http,net.tcp 

    DNS is definetly not the problem. The host name resolves properly to the IP address. The developer has checked that. Using the host name works fine when connecting over HTTP.

    My guess is that I get 0.0.0.0 because I specified 8301:*, where the wildcard is the equivalent to "all unassigned". HTTP behaves the same way, however when you specify an IP address, rather than "all unassigned", the server continues to listen on all (0.0.0.0) unless you disable socket pooling on http.sys. I disable http.sys socket pooling on all my servers using httpcfg.exe (IIS6) or netsh http (IIS7).

    Thanks
    Thursday, December 18, 2008 8:09 PM
  •  Hi Brandon,

    I have tested the exact same scenario as you said.
    At the beginning it exposed the similar problem as you described such as:
     
    server side:8031:192.168.2.100  client side: myserver        got the exception

    The key point is that you need to enable the port access in your window firewall or equivillent. This is done by add port in windows firewall exception. One port for the netTcpBinding endpoint and one for the metadata endpoint. It depends on which service you want your client to access.

    hope this will help
    cheers
    Binze

    Tuesday, December 23, 2008 7:43 AM
  • I only added a firewall exception for TCP 8031. We are using net.tcp Port Sharing for the services. Is there still another port we need to specify? From what we understand, net.tcp Port Sharing allows us to host multiple services using a single port.

    Thanks for all of your help.
    Thursday, December 25, 2008 4:51 PM