none
Error when creating a net.tcp endpoint in wcf

    Question

  •  

    I am trying to create a simple wcf service that has a net.tcp endpoint.  My OS is Vista and I am hosting the service in IIS 7.  I have set my default website binding for net.tcp to “9200:*” and added net.Tcp to my Enabled Protocols in my website hosting the service and the default website.  Here is my Config Values:

     

    <system.serviceModel>

        <services>

          <service name="FirstWcfService.Service" behaviorConfiguration="ServiceBehavior">

            <!-- Service Endpoints -->

            <endpoint address="" binding="netTcpBinding" contract="FirstWcfService.IService"

                bindingConfiguration="tcpbinding"/>

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

            <endpoint address="" binding="wsHttpBinding" contract="FirstWcfService.IService"

                />

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

          </service>

        </services>

        <behaviors>

          <serviceBehaviors>

            <behavior name="ServiceBehavior">

              <!-- 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 -->

              <serviceMetadata httpGetEnabled="true" />

              <serviceDebug includeExceptionDetailInFaults="false"/>

            </behavior>

          </serviceBehaviors>

        </behaviors>

        <bindings>

          <netTcpBinding>

            <binding name="tcpbinding">

              <!--<security mode="None"></security>-->

              <security mode="None" />

            </binding>

          </netTcpBinding>

        </bindings>

      </system.serviceModel>

     

    The wsHttp endpoint seems to work fine.  When I try to add a service reference through VS2008 to “net.tcp://localhost:9200/FirstWcfServiceHost/Service.svc/mextcp” (my net.tcp endpoint), I receive this error:

     

    Metadata contains a reference that cannot be resolved: 'net.tcp://localhost:9200/FirstWcfServiceHost/Service.svc/mextcp'.

    The message could not be dispatched because the service at the endpoint address 'net.tcp://localhost:9200/FirstWcfServiceHost/Service.svc/mextcp' is unavailable for the protocol of the address.

    If the service is defined in the current solution, try building the solution and adding the service reference again.

    Now if I add the service using the wshttp endpoint, it will add the net.tcp endpoint to my client app.  But if I try to use the net.tcp endpoint, I get this error:

     

    {"The message could not be dispatched because the service at the endpoint address 'net.tcp://XXXXXXXXX:9200/FirstWcfServiceHost/Service.svc' is unavailable for the protocol of the address."}

    Monday, January 12, 2009 7:42 PM

Answers

All replies

  • What happens if you drop the port number?

    net.tcp://localhost/FirstWcfServiceHost/Service.svc/
    MCAD.NET MCTS Web 3.5 MCTS Data 3.5
    Tuesday, January 13, 2009 10:21 AM
  • I tried to add the reference with out the port number so net.tcp://localhost/FirstWcfServiceHost/Service.svc/ and I get the same error:

    Metadata contains a reference that cannot be resolved: 'net.tcp://localhost/FirstWcfServiceHost/Service.svc/'.
    The message could not be dispatched because the service at the endpoint address 'net.tcp://localhost/FirstWcfServiceHost/Service.svc/' is unavailable for the protocol of the address.
    If the service is defined in the current solution, try building the solution and adding the service reference again.
    Tuesday, January 13, 2009 1:31 PM
  • Are your NetTcp Listeners services started?

    From (http://www.devx.com/dotnet/Article/38407/1954),
     
    "All MEX endpoints have to implement a contract called IMetadataExchange. Visual Studio is not smart enough to add this interface for you. If you make a typo, this endpoint will error out. Also, a mexTcp endpoint cannot run under the same port as the real service unless port sharing is enabled. When a service contains more than one endpoint, it is better to use a base address and a relative addressing scheme for the endpoints. "

    Maybe add,
       </system.serviceModel>   
            <netTcpBinding> 
          <binding name="PortSharingBinding" portSharingEnabled="true">  
            <security mode="None" /> 
          </binding> 
        </netTcpBinding> 
        </bindings> 
        </system.serviceModel> 

    MCAD.NET MCTS Web 3.5 MCTS Data 3.5
    • Edited by Matt Crudington Tuesday, January 13, 2009 1:38 PM typo
    • Proposed as answer by Alandia Friday, April 22, 2011 8:57 AM
    Tuesday, January 13, 2009 1:37 PM
  • I went through the artical and some changes and added post sharing but still get the same error. I also made sure that nettcp listener is on and that the port 9200 is open. Here is my config now:

    <system.serviceModel>

    <services>

    <service behaviorConfiguration="TCPBehavior" name="FirstWcfService.Service">

    <endpoint address="" binding="netTcpBinding" bindingConfiguration="FirstWcfServiceTcpBinding"

    name="FirstWcfServiceTcp" contract="FirstWcfService.IService" />

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

    name="MexFirstWcfServiceTcp" contract="IMetadataExchange" />

    <host>

    <baseAddresses>

    <add baseAddress="net.tcp://localhost:9200/FirstWcfServiceHost/Service.svc" />

    </baseAddresses>

    </host>

    </service>

    </services>

    <behaviors>

    <serviceBehaviors>

    <behavior name="TCPBehavior">

    <serviceDebug includeExceptionDetailInFaults="true"/>

    <serviceMetadata />

    <serviceThrottling maxConcurrentCalls="100" maxConcurrentSessions="100" />

    <serviceTimeouts />

    </behavior>

    </serviceBehaviors>

    </behaviors>

    <bindings>

    <netTcpBinding>

    <binding name="FirstWcfServiceTcpBinding" maxBufferSize="2147483647"

    maxReceivedMessageSize="2147483647" portSharingEnabled="true"/>

    </netTcpBinding>

    </bindings>

    </system.serviceModel>

    Tuesday, January 13, 2009 3:36 PM
  • Hi,

    From you configuration file I found out there might be something wrong with your baseAddress.

    If your solution name space is "FirstWcfService" then the baseAddress should be: "net.tcp://localhost:9200/FirstWcfService"

    If you hosted your service in IIS, then you don't need to specify baseAddress just publish your service to IIS.

    Check this blog out:
    http://blogs.visoftinc.com/archive/2008/03/21/Metadata-Exchange-Using-SvcUtil-A-Cautionary-Tale.aspx

    Give it a try

    Cheers
    Binze


    • Edited by Bin-ze Zhao Tuesday, January 20, 2009 4:19 AM add
    • Marked as answer by edhickey Wednesday, February 4, 2009 12:08 AM
    Tuesday, January 20, 2009 3:47 AM
  • http works fine, i was able to generate the wsdl file. but the tcp config doesnt work. im not sure where it is failing. :(. i m not sure how to test it also, can i generate a wsdl file if it is net.tcp call? i have deployed it on windows server 2008, as net.tcp is not supported on iis 5.1.

    Configuration Error
    Description: An error occurred during the processing of a configuration file required to service this request. Please review the specific error details below and modify your configuration file appropriately.

    Parser Error Message: The binding at system.serviceModel/bindings/netTcpBinding does not have a configured binding named 'tcpBinding'. This is an invalid value for bindingConfiguration.

    Source Error:

    Line 94:     </bindings>
    Line 95:     <client>
    Line 96:       <endpoint address="net.tcp://localhost/WcfService_deploy/Service1.svc" binding="netTcpBinding"
    Line 97:         bindingConfiguration="tcpBinding" contract="ServiceReference.IService1"
    Line 98:         name="Sampletcp" />
     

    My config as are as below.

    My Service config is as below.

    <system.serviceModel>

        <client />

        <bindings>

         <!-- <basicHttpBinding>

            <binding name="httpBinding" />

          </basicHttpBinding>-->

           <netTcpBinding>

            <binding name="tcpBinding" />

          </netTcpBinding>

        </bindings>

        <services>

          <service name="WcfService.Service1">

            <clear />

          <!--  <endpoint address="http://localhost/WcfService_deploy/Service1.svc" binding="basicHttpBinding"

              bindingConfiguration="httpBinding" name="samplehttp" contract="WcfService.IService1"

              listenUriMode="Explicit">

            </endpoint>-->

            <endpoint address="net.tcp://localhost/WcfService_deploy/Service1.svc" binding="netTcpBinding"

              bindingConfiguration="tcpBinding" name="Sampletcp" contract="WcfService.IService1" />

          </service>

        </services>

        <behaviors>

          <serviceBehaviors>

            <behavior>

              <!-- To avoid disclosing metadata information, set the value below to false and remove the metadata endpoint above before deployment -->

              <serviceMetadata httpGetEnabled="true"/>

              <!-- 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"/>

            </behavior>

          </serviceBehaviors>

        </behaviors>

        <serviceHostingEnvironment multipleSiteBindingsEnabled="false" />

      </system.serviceModel>

     

    My UI Config looks like this

    <system.serviceModel>

        <bindings>

          <basicHttpBinding>

            <binding name="samplehttp" closeTimeout="00:01:00" openTimeout="00:01:00"

              receiveTimeout="00:10:00" sendTimeout="00:01:00" allowCookies="false"

              bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard"

              maxBufferSize="65536" maxBufferPoolSize="524288" maxReceivedMessageSize="65536"

              messageEncoding="Text" textEncoding="utf-8" transferMode="Buffered"

              useDefaultWebProxy="true">

              <readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384"

                maxBytesPerRead="4096" maxNameTableCharCount="16384" />

              <security mode="None">

                <transport clientCredentialType="None" proxyCredentialType="None"

                  realm="" />

                <message clientCredentialType="UserName" algorithmSuite="Default" />

              </security>

            </binding>

          </basicHttpBinding>

        </bindings>

        <client>

          <endpoint address="net.tcp://localhost/WcfService_deploy/Service1.svc" binding="netTcpBinding"

            bindingConfiguration="tcpBinding" contract="ServiceReference.IService1"

            name="Sampletcp" />

        </client>

      </system.serviceModel>

     

    Please let me know how i can fix this error.  Thanks

    Tuesday, August 10, 2010 3:58 AM
  • I think i got the error. i did not mention netTcpBinding information in my config file. Now there is a different error :(

    I'm on windows server 2008, IIS7.5. i have deployed the sample wcf application on it.

    Following is the error

    No connection could be made because the target machine actively refused it [::1]:808

    Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

     

    Exception Details: System.Net.Sockets.SocketException: No connection could be made because the target machine actively refused it [::1]:808

     

        Exception type: SocketException

        Exception message: No connection could be made because the target machine actively refused it [::1]:808

       at System.Net.Sockets.Socket.DoConnect(EndPoint endPointSnapshot, SocketAddress socketAddress)

       at System.Net.Sockets.Socket.Connect(EndPoint remoteEP)

       at System.ServiceModel.Channels.SocketConnectionInitiator.Connect(Uri uri, TimeSpan timeout)

     

     This is the error message from Event log.

     Request information:

        Request URL: http://localhost/WebApplication_deploy

        Request path: /WebApplication_deploy

        User host address: 127.0.0.1

        User: 

        Is authenticated: False

        Authentication Type: 

        Thread account name: IIS APPPOOL\ASP.NET v4.0

     

    Thread information:

        Thread ID: 19

        Thread account name: IIS APPPOOL\ASP.NET v4.0

        Is impersonating: False

        Stack trace:    at System.Net.Sockets.Socket.DoConnect(EndPoint endPointSnapshot, SocketAddress socketAddress)

       at System.Net.Sockets.Socket.Connect(EndPoint remoteEP)

       at System.ServiceModel.Channels.SocketConnectionInitiator.Connect(Uri uri, TimeSpan timeout)

    Tuesday, August 10, 2010 5:00 PM
  • HTTP was working fine but my net.TCP was endpoint was failing with:

    The message could not be dispatched because the service at the endpoint address 'net.tcp://[host]/[service].svc' is unavailable for the protocol of the address.

    On the server I checked the applicaiton event log and found these two errors repeating for my single failed call:

    An error occurred while trying to start an app domain protocol listener channel.
    Exception: System.ServiceModel.CommunicationException
    Message: The TransportManager failed to listen on the supplied URI using the NetTcpPortSharing service: .
    StackTrace:    at System.ServiceModel.Channels.SharedConnectionListener.SharedListenerProxy.Register()
       at System.ServiceModel.Channels.SharedConnectionListener.SharedListenerProxy.Open(Boolean isReconnecting)
       at System.ServiceModel.Channels.SharedConnectionListener.StartListen(Boolean isReconnecting)
       at System.ServiceModel.Channels.SharedTcpTransportManager.OnOpenInternal(Int32 queueId, Guid token)
       at System.ServiceModel.Activation.HostedTcpTransportManager.Start(Int32 queueId, Guid token, Action messageReceivedCallback)
       at System.ServiceModel.WasHosting.TcpAppDomainProtocolHandler.OnStart()
       at System.ServiceModel.WasHosting.BaseAppDomainProtocolHandler.StartListenerChannel(IListenerChannelCallback listenerChannelCallback)
       at System.Web.Hosting.ListenerAdapterDispatchShim.StartListenerChannel(AppDomainProtocolHandler handler, IListenerChannelCallback listenerCallback)
       at System.Web.Hosting.ProcessHost.StartAppDomainProtocolListenerChannel(String appId, String protocolId, IListenerChannelCallback listenerChannelCallback)

    and

    An error occurred while trying to listen for the URL '***'. This worker process will be terminated.
     Sender Information: net.tcp
     Exception: System.ServiceModel.WasHosting.TcpAppDomainProtocolHandler/35287174
     Process Name: System.ServiceModel.CommunicationException: The TransportManager failed to listen on the supplied URI using the NetTcpPortSharing service: .
       at System.ServiceModel.Channels.SharedConnectionListener.SharedListenerProxy.Register()
       at System.ServiceModel.Channels.SharedConnectionListener.SharedListenerProxy.Open(Boolean isReconnecting)
       at System.ServiceModel.Channels.SharedConnectionListener.StartListen(Boolean isReconnecting)
       at System.ServiceModel.Channels.SharedTcpTransportManager.OnOpenInternal(Int32 queueId, Guid token)
       at System.ServiceModel.Activation.HostedTcpTransportManager.Start(Int32 queueId, Guid token, Action messageReceivedCallback)
       at System.ServiceModel.WasHosting.TcpAppDomainProtocolHandler.OnStart()
       at System.ServiceModel.WasHosting.BaseAppDomainProtocolHandler.StartListenerChannel(IListenerChannelCallback listenerChannelCallback)
     Process ID: w3wp

    I resolved the issue by repairing the service model installation on the server with:

    C:\Windows\Microsoft.NET\Framework64\v4.0.30319>ServiceModelReg.exe -r

    More info on ServiceModel Registration Tool @ http://msdn.microsoft.com/en-us/library/ms732012.aspx

    Hope this saves someone the time I lost.
    • Proposed as answer by TomTom1234 Thursday, September 30, 2010 8:00 AM
    Tuesday, August 31, 2010 11:03 PM
  • Sean,

     

    thank you so much for sharing this.

     

    one of our application server clusters (2k8 R2) got updated by our windows admins (some services packs / patches were applied), after which the entire cluster was unable to run any net.tcp services.

     

    running C:\Windows\Microsoft.NET\Framework64\v4.0.30319>ServiceModelReg.exe -r fixed the problem, although i'm still extremely pissed to see this happening just because some patches from Microsoft's very own WSUS were applied :@

     


    Thursday, September 30, 2010 8:03 AM
  • HTTP was working fine but my net.TCP was endpoint was failing with:

    The message could not be dispatched because the service at the endpoint address 'net.tcp://[host]/[service].svc' is unavailable for the protocol of the address.

    On the server I checked the applicaiton event log and found these two errors repeating for my single failed call:

    An error occurred while trying to start an app domain protocol listener channel.
    Exception: System.ServiceModel.CommunicationException
    Message: The TransportManager failed to listen on the supplied URI using the NetTcpPortSharing service: .
    StackTrace:    at System.ServiceModel.Channels.SharedConnectionListener.SharedListenerProxy.Register()
       at System.ServiceModel.Channels.SharedConnectionListener.SharedListenerProxy.Open(Boolean isReconnecting)
       at System.ServiceModel.Channels.SharedConnectionListener.StartListen(Boolean isReconnecting)
       at System.ServiceModel.Channels.SharedTcpTransportManager.OnOpenInternal(Int32 queueId, Guid token)
       at System.ServiceModel.Activation.HostedTcpTransportManager.Start(Int32 queueId, Guid token, Action messageReceivedCallback)
       at System.ServiceModel.WasHosting.TcpAppDomainProtocolHandler.OnStart()
       at System.ServiceModel.WasHosting.BaseAppDomainProtocolHandler.StartListenerChannel(IListenerChannelCallback listenerChannelCallback)
       at System.Web.Hosting.ListenerAdapterDispatchShim.StartListenerChannel(AppDomainProtocolHandler handler, IListenerChannelCallback listenerCallback)
       at System.Web.Hosting.ProcessHost.StartAppDomainProtocolListenerChannel(String appId, String protocolId, IListenerChannelCallback listenerChannelCallback)

    and

    An error occurred while trying to listen for the URL '***'. This worker process will be terminated.
     Sender Information: net.tcp
     Exception: System.ServiceModel.WasHosting.TcpAppDomainProtocolHandler/35287174
     Process Name: System.ServiceModel.CommunicationException: The TransportManager failed to listen on the supplied URI using the NetTcpPortSharing service: .
       at System.ServiceModel.Channels.SharedConnectionListener.SharedListenerProxy.Register()
       at System.ServiceModel.Channels.SharedConnectionListener.SharedListenerProxy.Open(Boolean isReconnecting)
       at System.ServiceModel.Channels.SharedConnectionListener.StartListen(Boolean isReconnecting)
       at System.ServiceModel.Channels.SharedTcpTransportManager.OnOpenInternal(Int32 queueId, Guid token)
       at System.ServiceModel.Activation.HostedTcpTransportManager.Start(Int32 queueId, Guid token, Action messageReceivedCallback)
       at System.ServiceModel.WasHosting.TcpAppDomainProtocolHandler.OnStart()
       at System.ServiceModel.WasHosting.BaseAppDomainProtocolHandler.StartListenerChannel(IListenerChannelCallback listenerChannelCallback)
     Process ID: w3wp

    I resolved the issue by repairing the service model installation on the server with:

    C:\Windows\Microsoft.NET\Framework64\v4.0.30319>ServiceModelReg.exe -r

    More info on ServiceModel Registration Tool @ http://msdn.microsoft.com/en-us/library/ms732012.aspx

    Hope this saves someone the time I lost.


    Thanks Sean_Mackey, but this didn't appear to help.

    I tried what you suggested for both .Net 4.0 and 3.5 with no apparant luck.

     

     I've been setting up a set of templates to release with our companies Self Service enterprise app.
    The idea being that the consultants can just run with them and they'll work.
    I've currently got:
    A bog standard wsHttpBinding set of endpoints.
    An IPC set of endpoints.
    A netTcpBinding set of endpoints that I was going to use for an intranet scenario.
    The above configurations are running on a clean install of Server 2008r2, IIS7.5.
    Have also tried on my dev box (windows 7).

    The Http and IPC work fine.
    The Http and Tcp are targeting multi machines. I.E. our services (targeting .net3.5) on one box, our web app (targeting .net4.0) on the other box.

    The most common solution to the problem seems to be along these lines...
    http://social.msdn.microsoft.com/Forums/en-US/wcf/thread/c6e1a2e7-e0ce-4b11-aaf0-d42d643a2523
    1. Uninstall all IIS components and .Net 3.5.1 Activation services
    2. Reboot
    3. Install IIS components and .Net 3.5.1 Activation services
    4. Reboot

    The odd thing with this is... If I have a clean machine, I carried out steps 3 and 4 by default anyway.

    This is the error I get logged from the web app.

    Exception message: Error retrieving blah
    Inner exception message: The message could not be dispatched because the service at the endpoint address 'net.tcp://localhost/WebApp/MyService.svc/NetTcp' is unavailable for the protocol of the address.

    OurBusinessException: Error retrieving blah ---> System.ServiceModel.EndpointNotFoundException: The message could not be dispatched because the service at the endpoint address 'net.tcp://localhost/WebApp/MyService.svc/NetTcp' is unavailable for the protocol of the address.

    Server stack trace:
       at System.ServiceModel.Channels.ConnectionUpgradeHelper.DecodeFramingFault(ClientFramingDecoder decoder, IConnection connection, Uri via, String contentType, TimeoutHelper& timeoutHelper)
       at System.ServiceModel.Channels.ClientFramingDuplexSessionChannel.SendPreamble(IConnection connection, ArraySegment`1 preamble, TimeoutHelper& timeoutHelper)
       at System.ServiceModel.Channels.ClientFramingDuplexSessionChannel.DuplexConnectionPoolHelper.AcceptPooledConnection(IConnection connection, TimeoutHelper& timeoutHelper)
       at System.ServiceModel.Channels.ConnectionPoolHelper.EstablishConnection(TimeSpan timeout)
       at System.ServiceModel.Channels.ClientFramingDuplexSessionChannel.OnOpen(TimeSpan timeout)
       at System.ServiceModel.Channels.CommunicationObject.Open(TimeSpan timeout)
       at System.ServiceModel.Channels.ServiceChannel.OnOpen(TimeSpan timeout)
       at System.ServiceModel.Channels.CommunicationObject.Open(TimeSpan timeout)
       at System.ServiceModel.Channels.ServiceChannel.CallOnceManager.CallOnce(TimeSpan timeout, CallOnceManager cascade)
       at System.ServiceModel.Channels.ServiceChannel.EnsureOpened(TimeSpan timeout)
       at System.ServiceModel.Channels.ServiceChannel.Call(String action, Boolean oneway, ProxyOperationRuntime operation, Object[] ins, Object[] outs, TimeSpan timeout)
       at System.ServiceModel.Channels.ServiceChannelProxy.InvokeService(IMethodCallMessage methodCall, ProxyOperationRuntime operation)
       at System.ServiceModel.Channels.ServiceChannelProxy.Invoke(IMessage message)



    Config files follow.



    //-------------------Services Config---------------------------

    <?xml version="1.0"?>
    <configuration>
      <system.serviceModel>
        <services>
          <service name="MyServiceImplementation" behaviorConfiguration="MEX">
            <!--wsHttp endpoints-->
            <endpoint address="" binding="wsHttpBinding" contract="InterfaceOfMyServiceImplementation"/>
            <endpoint contract="IMetadataExchange" binding="mexHttpBinding" address="mex"/>
           
            <!--IPC endpoints-->
            <endpoint address="IPC" binding="netNamedPipeBinding" contract="InterfaceOfMyServiceImplementation" />
            <endpoint contract="IMetadataExchange" binding="mexNamedPipeBinding" address="mex" />
           
            <!--netTcp endpoints-->
            <endpoint address="NetTcp" binding="netTcpBinding" bindingConfiguration="NetTcpBinding" contract="InterfaceOfMyServiceImplementation" />
            <!--<endpoint contract="IMetadataExchange" binding="mexTcpBinding" address="mex" />-->
            <!--add the below line to the endpoint to turn on capturing SOAP messages-->
            <!--behaviorConfiguration="messageInspectorBehavior"-->
          </service>
        </services>

        <bindings>
          <netNamedPipeBinding>
            <binding closeTimeout="00:01:00" openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00" transactionFlow="false" transferMode="Buffered" transactionProtocol="OleTransactions" hostNameComparisonMode="StrongWildcard" maxBufferPoolSize="524288" maxBufferSize="65536" maxConnections="10" maxReceivedMessageSize="65536">
                <security mode="Transport">
                  <transport protectionLevel="EncryptAndSign"/>
                </security>
            </binding>
          </netNamedPipeBinding>
          <wsHttpBinding>
            <binding maxReceivedMessageSize="655360">
              <security mode="None"/>
            </binding>
          </wsHttpBinding>
          <netTcpBinding>
            <binding name="NetTcpBinding" portSharingEnabled="true">
              <security mode = "Transport">
                <transport
                   clientCredentialType = "Windows"
                   protectionLevel = "EncryptAndSign"
                />
              </security>
            </binding>
          </netTcpBinding>
        </bindings>

        <behaviors>
          <serviceBehaviors>       
            <behavior name="MEX">
              <serviceMetadata/>
              <serviceDebug includeExceptionDetailInFaults="True"/>
            </behavior>
          </serviceBehaviors>     
        </behaviors>

        <serviceHostingEnvironment>
          <serviceActivations>       
            <add relativeAddress="MyService.svc" service="MyServiceImplementation"/>       
          </serviceActivations>
        </serviceHostingEnvironment>
      </system.serviceModel> 
    </configuration>

    //--------------------------Client config------------------------------------

    // in the Web.config...

        <system.serviceModel>
        <bindings configSource=".\bin\Bindings.config"></bindings>
        <client configSource=".\bin\Client.config"></client>
        </system.serviceModel>

    // in the Bindings.config.... it looks the same as the services bindings.
    // in the Client.config....

    <client>
      <!--Http endpoints ... currently commented out, but work fine when un commented   
      <endpoint address="http://localhost/WebApp/MyService.svc " binding="wsHttpBinding" bindingConfiguration="HttpBindingNameFromBindings.config" contract="InterfaceOfMyServiceImplementationProxy" name="NotUsed" />
      -->

      <!--IPC endpoints .... currently commented out, but work fine when un commented 
      <endpoint address="net.pipe://localhost/WebApp/MyService.svc/IPC" binding="netNamedPipeBinding" bindingConfiguration="IPCBindingNameFromBindings.config" contract="InterfaceOfMyServiceImplementationProxy" name="NotUsed" />
      -->

      <!--netTcp endpoints--> 
      <endpoint address="net.tcp://localhost/WebApp/MyService.svc/NetTcp" binding="netTcpBinding" bindingConfiguration="netTcpBindingNameFromBindings.config" contract="InterfaceOfMyServiceImplementationProxy" name="NotUsed" />
     
    </client>

    and from the event viewer:

    The first error:

     

    An error occurred while trying to listen for the URL '/LM/W3SVC/1/ROOT/WebApp'. This worker process will be terminated.
     Sender Information: net.tcp
     Exception: System.ServiceModel.WasHosting.TcpAppDomainProtocolHandler/59633319
     Process Name: System.ServiceModel.CommunicationException: The TransportManager failed to listen on the supplied URI using the NetTcpPortSharing service: .
       at System.ServiceModel.Channels.SharedConnectionListener.SharedListenerProxy.Register()
       at System.ServiceModel.Channels.SharedConnectionListener.SharedListenerProxy.Open(Boolean isReconnecting)
       at System.ServiceModel.Channels.SharedConnectionListener.StartListen(Boolean isReconnecting)
       at System.ServiceModel.Channels.SharedTcpTransportManager.OnOpenInternal(Int32 queueId, Guid token)
       at System.ServiceModel.Activation.HostedTcpTransportManager.Start(Int32 queueId, Guid token, Action messageReceivedCallback)
       at System.ServiceModel.WasHosting.TcpAppDomainProtocolHandler.OnStart()
       at System.ServiceModel.WasHosting.BaseAppDomainProtocolHandler.StartListenerChannel(IListenerChannelCallback listenerChannelCallback)
     Process ID: w3wp

     

    and the second error...

     

     

    An error occurred while trying to start an app domain protocol listener channel.

    Exception: System.ServiceModel.CommunicationException

    Message: The TransportManager failed to listen on the supplied URI using the NetTcpPortSharing service: .

    StackTrace:    at System.ServiceModel.Channels.SharedConnectionListener.SharedListenerProxy.Register()
       at System.ServiceModel.Channels.SharedConnectionListener.SharedListenerProxy.Open(Boolean isReconnecting)
       at System.ServiceModel.Channels.SharedConnectionListener.StartListen(Boolean isReconnecting)
       at System.ServiceModel.Channels.SharedTcpTransportManager.OnOpenInternal(Int32 queueId, Guid token)
       at System.ServiceModel.Activation.HostedTcpTransportManager.Start(Int32 queueId, Guid token, Action messageReceivedCallback)
       at System.ServiceModel.WasHosting.TcpAppDomainProtocolHandler.OnStart()
       at System.ServiceModel.WasHosting.BaseAppDomainProtocolHandler.StartListenerChannel(IListenerChannelCallback listenerChannelCallback)
       at System.Web.Hosting.ListenerAdapterDispatchShim.StartListenerChannel(AppDomainProtocolHandler handler, IListenerChannelCallback listenerCallback)
       at System.Web.Hosting.ProcessHost.StartAppDomainProtocolListenerChannel(String appId, String protocolId, IListenerChannelCallback listenerChannelCallback)

    Friday, October 1, 2010 8:32 AM
  • HTTP was working fine but my net.TCP was endpoint was failing with:

    The message could not be dispatched because the service at the endpoint address 'net.tcp://[host]/[service].svc' is unavailable for the protocol of the address.

    On the server I checked the applicaiton event log and found these two errors repeating for my single failed call:

    An error occurred while trying to start an app domain protocol listener channel.
    Exception: System.ServiceModel.CommunicationException
    Message: The TransportManager failed to listen on the supplied URI using the NetTcpPortSharing service: .
    StackTrace:    at System.ServiceModel.Channels.SharedConnectionListener.SharedListenerProxy.Register()
       at System.ServiceModel.Channels.SharedConnectionListener.SharedListenerProxy.Open(Boolean isReconnecting)
       at System.ServiceModel.Channels.SharedConnectionListener.StartListen(Boolean isReconnecting)
       at System.ServiceModel.Channels.SharedTcpTransportManager.OnOpenInternal(Int32 queueId, Guid token)
       at System.ServiceModel.Activation.HostedTcpTransportManager.Start(Int32 queueId, Guid token, Action messageReceivedCallback)
       at System.ServiceModel.WasHosting.TcpAppDomainProtocolHandler.OnStart()
       at System.ServiceModel.WasHosting.BaseAppDomainProtocolHandler.StartListenerChannel(IListenerChannelCallback listenerChannelCallback)
       at System.Web.Hosting.ListenerAdapterDispatchShim.StartListenerChannel(AppDomainProtocolHandler handler, IListenerChannelCallback listenerCallback)
       at System.Web.Hosting.ProcessHost.StartAppDomainProtocolListenerChannel(String appId, String protocolId, IListenerChannelCallback listenerChannelCallback)

    and

    An error occurred while trying to listen for the URL '***'. This worker process will be terminated.
     Sender Information: net.tcp
     Exception: System.ServiceModel.WasHosting.TcpAppDomainProtocolHandler/35287174
     Process Name: System.ServiceModel.CommunicationException: The TransportManager failed to listen on the supplied URI using the NetTcpPortSharing service: .
       at System.ServiceModel.Channels.SharedConnectionListener.SharedListenerProxy.Register()
       at System.ServiceModel.Channels.SharedConnectionListener.SharedListenerProxy.Open(Boolean isReconnecting)
       at System.ServiceModel.Channels.SharedConnectionListener.StartListen(Boolean isReconnecting)
       at System.ServiceModel.Channels.SharedTcpTransportManager.OnOpenInternal(Int32 queueId, Guid token)
       at System.ServiceModel.Activation.HostedTcpTransportManager.Start(Int32 queueId, Guid token, Action messageReceivedCallback)
       at System.ServiceModel.WasHosting.TcpAppDomainProtocolHandler.OnStart()
       at System.ServiceModel.WasHosting.BaseAppDomainProtocolHandler.StartListenerChannel(IListenerChannelCallback listenerChannelCallback)
     Process ID: w3wp

    I resolved the issue by repairing the service model installation on the server with:

    C:\Windows\Microsoft.NET\Framework64\v4.0.30319>ServiceModelReg.exe -r

    More info on ServiceModel Registration Tool @ http://msdn.microsoft.com/en-us/library/ms732012.aspx

    Hope this saves someone the time I lost.

    Thanks for sharing this tip, it worked for me twice. : )
    Thursday, October 13, 2011 12:18 PM
  • Fixed it for me! Thank you very much - this one was driving me up the wall.
    Wednesday, November 2, 2011 1:19 AM
  • HTTP was working fine but my net.TCP was endpoint was failing with:

    The message could not be dispatched because the service at the endpoint address 'net.tcp://[host]/[service].svc' is unavailable for the protocol of the address.

    On the server I checked the applicaiton event log and found these two errors repeating for my single failed call:

    An error occurred while trying to start an app domain protocol listener channel.
    Exception: System.ServiceModel.CommunicationException
    Message: The TransportManager failed to listen on the supplied URI using the NetTcpPortSharing service: .
    StackTrace:    at System.ServiceModel.Channels.SharedConnectionListener.SharedListenerProxy.Register()
       at System.ServiceModel.Channels.SharedConnectionListener.SharedListenerProxy.Open(Boolean isReconnecting)
       at System.ServiceModel.Channels.SharedConnectionListener.StartListen(Boolean isReconnecting)
       at System.ServiceModel.Channels.SharedTcpTransportManager.OnOpenInternal(Int32 queueId, Guid token)
       at System.ServiceModel.Activation.HostedTcpTransportManager.Start(Int32 queueId, Guid token, Action messageReceivedCallback)
       at System.ServiceModel.WasHosting.TcpAppDomainProtocolHandler.OnStart()
       at System.ServiceModel.WasHosting.BaseAppDomainProtocolHandler.StartListenerChannel(IListenerChannelCallback listenerChannelCallback)
       at System.Web.Hosting.ListenerAdapterDispatchShim.StartListenerChannel(AppDomainProtocolHandler handler, IListenerChannelCallback listenerCallback)
       at System.Web.Hosting.ProcessHost.StartAppDomainProtocolListenerChannel(String appId, String protocolId, IListenerChannelCallback listenerChannelCallback)

    and

    An error occurred while trying to listen for the URL '***'. This worker process will be terminated.
     Sender Information: net.tcp
     Exception: System.ServiceModel.WasHosting.TcpAppDomainProtocolHandler/35287174
     Process Name: System.ServiceModel.CommunicationException: The TransportManager failed to listen on the supplied URI using the NetTcpPortSharing service: .
       at System.ServiceModel.Channels.SharedConnectionListener.SharedListenerProxy.Register()
       at System.ServiceModel.Channels.SharedConnectionListener.SharedListenerProxy.Open(Boolean isReconnecting)
       at System.ServiceModel.Channels.SharedConnectionListener.StartListen(Boolean isReconnecting)
       at System.ServiceModel.Channels.SharedTcpTransportManager.OnOpenInternal(Int32 queueId, Guid token)
       at System.ServiceModel.Activation.HostedTcpTransportManager.Start(Int32 queueId, Guid token, Action messageReceivedCallback)
       at System.ServiceModel.WasHosting.TcpAppDomainProtocolHandler.OnStart()
       at System.ServiceModel.WasHosting.BaseAppDomainProtocolHandler.StartListenerChannel(IListenerChannelCallback listenerChannelCallback)
     Process ID: w3wp

    I resolved the issue by repairing the service model installation on the server with:

    C:\Windows\Microsoft.NET\Framework64\v4.0.30319>ServiceModelReg.exe -r

    More info on ServiceModel Registration Tool @ http://msdn.microsoft.com/en-us/library/ms732012.aspx

    Hope this saves someone the time I lost.

    This tip saved me a full day !!
    Friday, March 16, 2012 5:45 PM
  • Sean, you are a wonderful human being.  You just saved me what could have been a few days of investigating.  Running the service model registration tool solved the same issue for me.

    Cheers!

    Friday, March 23, 2012 2:30 PM
  • This happened to me also. I found an easy fix, Go to IIS, click on the advanced settings for your application virtual directory and under the enabled protocols add net.tcp.

    Note: additional values are comma delimited. 


    http://ssis-stuff.blogspot.com

    • Proposed as answer by Gautam Beri Tuesday, September 4, 2012 1:26 PM
    Tuesday, September 4, 2012 1:26 PM
  • Generous helper\s,

    I'm having the same issue. My config file almost the same as mentioned above by above gentle man. only difference I'm using    as <netTcpBinding>
            <binding name="NetTcpBinding" portSharingEnabled="true">
              <security mode = "Transport">
                <transport
                   clientCredentialType = "Windows"
                           />

    using httpenabled = false.

    the interesting thing is wcf service works well, if complied in .netframework 3.5 and in server side application pool is v2.0

    But when the same wcf service build in .netframework 4 and keep application pool (any version v2.0, v4) , it does not work and gives an error in client side

    The message could not be dispatched because the service at the endpoint address 'net.tcp://[host]/[service].svc' is unavailable for the protocol of the address.

    No error in the event log in server. 

    I'm using VS 2010, server = windows 2008, IIS 7.0, in server WAS is . net frame 3.0 [to activate, non HTTP and HTTP ]

    [No code change and tried with every changes required in server side. 

    Set app pool as v4 , ran C:\Windows\Microsoft.NET\Framework64\v4.0.30319>ServiceModelReg.exe -r

    More strangely v4 works fine with http bindings for all other services. 

    any help input appreciated.

    Tuesday, November 27, 2012 4:11 AM
  • I spent so many hours trying to figure out what I was doing wrong!  This worked!!!!

    Wednesday, November 28, 2012 3:52 PM
  • I resolved the issue by repairing the service model installation on the server with:

    C:\Windows\Microsoft.NET\Framework64\v4.0.30319>ServiceModelReg.exe -r

    More info on ServiceModel Registration Tool @ http://msdn.microsoft.com/en-us/library/ms732012.aspx

    Hope this saves someone the time I lost.

      I spent so many hours trying to figure out what I was doing wrong!  This worked!!!!
    Wednesday, November 28, 2012 3:53 PM
  • Hi CMRemaly

    Big Thanks............. for your information provided, me and my team spent huge time to understand the issue and fix the issue but no luck. by following your answer its resolved in a min.

    Thanks

    Sanjiv


    Cheers, Sanjiv Kumar Sanjiv Blog | LinkedIn

    Tuesday, April 8, 2014 1:19 PM
  • Thank you so much for sharing this solution. After Struggled a lot to fix this issue......got solution from your post.

    Regards Sai

    Sunday, August 16, 2015 8:17 AM