locked
Failing to Establish Connection to WCF using NET.TCP Protocol RRS feed

  • Question

  • User1489816430 posted

    Hi All!

    Hopefully someone can provide some insight to this issue. I have been struggling to resolve the problem for 4 days now and have totally exhausted every resource, searched every possible forum and googled every possible keyword search but can't get a resolution for this.

    I have setup a WCF service and hosted it using IIS7. When using the IIS7 website (which is only local to my system on Windows 7) and make calls to any endpoint which uses HTTP the results is successful; but when I attempt to access the one endpoint I have defined using the NET.TCP protocol I receive timeouts.

    I have disabled my firewall, ensured that IIS is configured to accept http, net.tcp protocols and made certain that they are enabled, used the appcmd utility to configure the site to use the IP address or localhost or computername (not all at once of course but I have tried each of these configurations), aborted using IIS7 explicity and setup a WAS application under the site thinking that maybe using IIS7 that the site may be only using the HTTP protocol. So far nothing has worked.

    All applicable services are running (NetTcpActivator, NetTcpPortSharing and WAS). I have even ran the svcTraceViewer in effort of trying to determine why my service is timing out but can't find any clue to the problem. The error I am getting is "The open operation did not complete within the allotted timeout of 00:01:00. The time allotted to this operation may have been a portion of a longer timeout."

    I have raised the timeout threshold but it doesn't make a difference. I thought that using the NET.TCP protocol would prove to be faster that HTTP so what is the call waiting on? I can provide the logs, code portions or anything that may help to resolve my issue.

    One thing that I did notice is that although I tried defining my endpoint for the NET.TCP protocol using the IP address on my system that when the service gets called it seems to want to use the Ipv6 protocol. Not certain if this is an issue though.

    Plz HELP!

    Sunday, March 7, 2010 10:41 AM

Answers

  • User-1234160842 posted

    Hi,

    No net.tcp does not require a callback to be defined in your service.

    I tried to create a simple wcf service, and try to enable net.tcp on it. I don't have window7, so i had done it on vista. In my case i also receive the timeout, but it was as the entry in my config files were wrong.

    Make sure that you specify the address="" in the endpoint declaration, because in my case when i specified any other address, it did not work. this is the relevant entry of wcf service .


    <services>
    <service name="TestWcfService.Service1" behaviorConfiguration="TestWcfService.Service1Behavior">
    <!-- Service Endpoints -->
    <endpoint address="" binding="wsHttpBinding" contract="TestWcfService.IService1">
    <!-- 
                  Upon deployment, the following identity element should be removed or replaced to reflect the 
                  identity under which the deployed service runs.  If removed, WCF will infer an appropriate identity 
                  automatically.
              -->
    <identity>
    <dns value="localhost"/>
    </identity>
    </endpoint>
            <endpoint address="" binding="netTcpBinding" contract="TestWcfService.IService1"></endpoint>
    <endpoint address="mex" binding="mexHttpBinding" bindingConfiguration=""
              contract="IMetadataExchange" />
    </service>
    </services>

    <services>

    <service name="TestWcfService.Service1" behaviorConfiguration="TestWcfService.Service1Behavior">

    <!-- Service Endpoints -->

    <endpoint address="" binding="wsHttpBinding" contract="TestWcfService.IService1">

    <!-- 

                  Upon deployment, the following identity element should be removed or replaced to reflect the 

                  identity under which the deployed service runs.  If removed, WCF will infer an appropriate identity 

                  automatically.

              -->

    <identity>

    <dns value="localhost"/>

    </identity>

    </endpoint>

            <endpoint address="" binding="netTcpBinding" contract="TestWcfService.IService1"></endpoint>

    <endpoint address="mex" binding="mexHttpBinding" bindingConfiguration=""

              contract="IMetadataExchange" />


    </service>

    </services>


    after this i used the svcutil and generated the proxy class and it did worked.  Please try it and let me know how it goes.


    If it does not work can you please post the following the wcf service config file only the service portion, the config file you generated through proxy the client portion.

    Also check that in the applicationHost.config file ( which is found at C:\windows\System32\inetsrv\config)

    you have entry like this.

    <application path="/WcfTest" applicationPool="TestWcf" enabledProtocols="http,net.tcp">

                        <virtualDirectory path="/" physicalPath="C:\inetpub\wwwroot\TestWcf" />

                    </application>

                    <bindings>

                        <binding protocol="http" bindingInformation="*:80:" />

                        <binding protocol="net.tcp" bindingInformation="808:*" />

                        <binding protocol="net.pipe" bindingInformation="*" />

                        <binding protocol="net.msmq" bindingInformation="localhost" />

                        <binding protocol="msmq.formatname" bindingInformation="localhost" />

                        <binding protocol="https" bindingInformation="*:443:" />

                    </bindings>


    it will be under the <sites><site> node.

    /WcfTest is your wcf application hosted on iis.





    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Monday, March 8, 2010 11:55 AM

All replies

  • User-1234160842 posted

    Hi can you check the following steps, it is an excerpt from the microsoft book for supporting non-http protocols.

    If you plan on supporting non-HTTP protocols, you must configure WAS by using the
    Windows Features option available with Windows Vista. To begin, click Start, and then click
    Control Panel. Choose Programs, and then click Turn Windows Features On Or Off under the
    Programs And Features heading. Expand the node for Microsoft .NET Framework 3.0 and
    select the Windows Communication Foundation Non-HTTP Activation check box. Click OK,
    and then close all Control Panel windows.
    To handle non-HTTP protocol requests, IIS 7.0 and WAS use a set of long-running Microsoft
    Windows NT services. These services, which represent listener adapters, are responsible for
    monitoring ports and receiving requests. The requests are then handled by an external process,
    SMSvcHost.exe.
    Each of the Windows NT services used for non-HTTP protocols must be running on the host
    computer before you can run any of the non-HTTP samples available on the MSDN Web site.
    To ensure that they are running, navigate to Services (on Windows Vista, in Control Panel,
    click System And Maintenance, and then click Administrative Tools. Double-click Services in
    the right-side pane) and check that the following services are started:
    Net.Pipe Listener Adapter
    Net.Tcp Listener Adapter
    Net.Tcp Port Sharing Service


    Also have a look at this article this might help

    http://msdn.microsoft.com/en-us/library/ee939285.aspx


    Sunday, March 7, 2010 1:44 PM
  • User1489816430 posted

    Hi!

    Thanks a lot for the reply. I have performed all the steps and confirmed that all the required services are configured and running. I also previously noted the article on msdn that you referenced but I read it again just to make certain that there was nothing I was missing.

    Is there a way to check to make certain that there is a listener on the IP and port that I specify in my WCF service? I tried netstat but none of the TCP protocols listed are using the port that I assigned. I really believe that something may be blocking the port that I am attempting to use that's causing the timeout but I have no way of knowing for certain. My firewall is off.

    net.tcp doesn't require a callback to be defined in my service does it???

    Sunday, March 7, 2010 5:17 PM
  • User-1234160842 posted

    Hi,

    No net.tcp does not require a callback to be defined in your service.

    I tried to create a simple wcf service, and try to enable net.tcp on it. I don't have window7, so i had done it on vista. In my case i also receive the timeout, but it was as the entry in my config files were wrong.

    Make sure that you specify the address="" in the endpoint declaration, because in my case when i specified any other address, it did not work. this is the relevant entry of wcf service .


    <services>
    <service name="TestWcfService.Service1" behaviorConfiguration="TestWcfService.Service1Behavior">
    <!-- Service Endpoints -->
    <endpoint address="" binding="wsHttpBinding" contract="TestWcfService.IService1">
    <!-- 
                  Upon deployment, the following identity element should be removed or replaced to reflect the 
                  identity under which the deployed service runs.  If removed, WCF will infer an appropriate identity 
                  automatically.
              -->
    <identity>
    <dns value="localhost"/>
    </identity>
    </endpoint>
            <endpoint address="" binding="netTcpBinding" contract="TestWcfService.IService1"></endpoint>
    <endpoint address="mex" binding="mexHttpBinding" bindingConfiguration=""
              contract="IMetadataExchange" />
    </service>
    </services>

    <services>

    <service name="TestWcfService.Service1" behaviorConfiguration="TestWcfService.Service1Behavior">

    <!-- Service Endpoints -->

    <endpoint address="" binding="wsHttpBinding" contract="TestWcfService.IService1">

    <!-- 

                  Upon deployment, the following identity element should be removed or replaced to reflect the 

                  identity under which the deployed service runs.  If removed, WCF will infer an appropriate identity 

                  automatically.

              -->

    <identity>

    <dns value="localhost"/>

    </identity>

    </endpoint>

            <endpoint address="" binding="netTcpBinding" contract="TestWcfService.IService1"></endpoint>

    <endpoint address="mex" binding="mexHttpBinding" bindingConfiguration=""

              contract="IMetadataExchange" />


    </service>

    </services>


    after this i used the svcutil and generated the proxy class and it did worked.  Please try it and let me know how it goes.


    If it does not work can you please post the following the wcf service config file only the service portion, the config file you generated through proxy the client portion.

    Also check that in the applicationHost.config file ( which is found at C:\windows\System32\inetsrv\config)

    you have entry like this.

    <application path="/WcfTest" applicationPool="TestWcf" enabledProtocols="http,net.tcp">

                        <virtualDirectory path="/" physicalPath="C:\inetpub\wwwroot\TestWcf" />

                    </application>

                    <bindings>

                        <binding protocol="http" bindingInformation="*:80:" />

                        <binding protocol="net.tcp" bindingInformation="808:*" />

                        <binding protocol="net.pipe" bindingInformation="*" />

                        <binding protocol="net.msmq" bindingInformation="localhost" />

                        <binding protocol="msmq.formatname" bindingInformation="localhost" />

                        <binding protocol="https" bindingInformation="*:443:" />

                    </bindings>


    it will be under the <sites><site> node.

    /WcfTest is your wcf application hosted on iis.





    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Monday, March 8, 2010 11:55 AM
  • User409024752 posted

    Did you find a solution to your problem? If yes, can you post it here?

    Wednesday, June 2, 2010 6:57 AM
  • User2043281626 posted

    I am having a similar issue as well. Did you ever find a solution?

    Monday, July 29, 2013 1:23 PM