WCF Service error received when using TCP: "The message could not be dispatched..."

Posted by StM on Stack Overflow See other posts from Stack Overflow or by StM
Published on 2011-03-28T19:11:26Z Indexed on 2012/09/21 3:38 UTC
Read the original article Hit count: 252

Filed under:
|
|
|

I am new to creating WCF services. I have created a WCF web service in VS2008 that is running on IIS 7. When I use http the service works perfectly. When I configure the service for TCP and run I get the following error message.

There was a communication problem. The message could not be dispatched because the service at the endpoint address 'net:tcp://elec:9090/CoordinateIdTool_Tcp/IdToolService.svc is unavailable for the protocol of the address.

I have searched a lot of forums, including this one, for a resolution but nothing has worked. Everything appears to be set up correctly on IIS 7. WAS has been set up to run. The default web site has a net.tcp binding and the application has net.tcp under the enabled protocols.

I am including what I think is the important part of the web.config from the host project and also the app.config from the client project I am using to test the service. Hopefully someone can spot my error. Thanks in advance for any help or recommendations that anyone can provide.

Web.Config

<bindings>
   <wsHttpBinding>
      <binding name="wsHttpBindingNoMsgs">
         <security mode="None" />
       </binding>
   </wsHttpBinding>
</bindings>
<services>
   <service behaviorConfiguration="CogIDServiceHost.ServiceBehavior"
           name="CogIDServiceLibrary.CogIdService">
      <endpoint address="" 
                binding="wsHttpBinding" 
                bindingConfiguration="wsHttpBindingNoMsgs"
                contract="CogIDServiceLibrary.CogIdTool">
         <identity>
            <dns value="localhost" />
         </identity>
      </endpoint>
      <endpoint address="mex" binding="mexHttpBinding" bindingConfiguration=""
                contract="IMetadataExchange" />
      <endpoint name="CoordinateIdService_TCP"
          address="net.tcp://elec:9090/CoordinateIdTool_Tcp/IdToolService.svc"
          binding="netTcpBinding" bindingConfiguration="" 
          contract="CogIDServiceLibrary.CogIdTool">
         <identity>
            <dns value="localhost" />
         </identity>
      </endpoint>
    </service>
 </services>
 <behaviors>
    <serviceBehaviors>
       <behavior name="CogIDServiceHost.ServiceBehavior">
          <serviceMetadata httpGetEnabled="true" />
          <serviceDebug includeExceptionDetailInFaults="false" />
       </behavior>
    </serviceBehaviors>
 </behaviors>

App.Config

<system.serviceModel>
    <diagnostics performanceCounters="Off">
        <messageLogging logEntireMessage="true" logMalformedMessages="false"
            logMessagesAtServiceLevel="false" logMessagesAtTransportLevel="false" />
    </diagnostics>
    <behaviors />
    <bindings>
        <wsHttpBinding>
            <binding name="WSHttpBinding_CogIdTool" closeTimeout="00:01:00"
                openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00"
                bypassProxyOnLocal="false" transactionFlow="false" hostNameComparisonMode="StrongWildcard"
                maxBufferPoolSize="524288" maxReceivedMessageSize="65536"
                messageEncoding="Text" textEncoding="utf-8" useDefaultWebProxy="true"
                allowCookies="false">
                <readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384"
                    maxBytesPerRead="4096" maxNameTableCharCount="16384" />
                <reliableSession ordered="true" inactivityTimeout="00:10:00"
                    enabled="false" />
                <security mode="None">
                    <transport clientCredentialType="Windows" proxyCredentialType="None"
                        realm="" />
                    <message clientCredentialType="Windows" negotiateServiceCredential="true"
                        establishSecurityContext="true" />
                </security>
            </binding>
            <binding name="wsHttpBindingNoMsg">
                <security mode="None">
                    <transport clientCredentialType="Windows" />
                    <message clientCredentialType="Windows" />
                </security>
            </binding>
        </wsHttpBinding>
    </bindings>
    <client>
        <endpoint address="http://sdet/CogId_WCF/IdToolService.svc" binding="wsHttpBinding"
            bindingConfiguration="wsHttpBindingNoMsg" contract="CogIdServiceReference.CogIdTool"
            name="IISHostWsHttpBinding">
            <identity>
                <dns value="localhost" />
            </identity>
        </endpoint>
        <endpoint address="http://localhost:1890/IdToolService.svc" binding="wsHttpBinding"
            bindingConfiguration="WSHttpBinding_CogIdTool" contract="CogIdServiceReference.CogIdTool"
            name="WSHttpBinding_CogIdTool">
            <identity>
                <dns value="localhost" />
            </identity>
        </endpoint>
        <endpoint address="http://elec/CoordinateIdTool/IdToolService.svc"
            binding="wsHttpBinding" bindingConfiguration="wsHttpBindingNoMsg"
            contract="CogIdServiceReference.CogIdTool" name="IIS7HostWsHttpBinding_Elec">
            <identity>
                <dns value="localhost" />
            </identity>
        </endpoint>
      <endpoint address="net.tcp://elec:9090/CoordinateIdTool_Tcp/IdToolService.svc"
          binding="netTcpBinding" bindingConfiguration="" contract="CogIdServiceReference.CogIdTool"
            name="IIS7HostTcpBinding_Elec" >
        <identity>
          <dns value="localhost"/>
        </identity>
      </endpoint>
    </client>
</system.serviceModel>

© Stack Overflow or respective owner

Related posts about c#

Related posts about wcf