开发者

Error received when using TCP: "The message could not be dispatched..."

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">
  开发者_StackOverflow       <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>


I think my problem was similar to yours. What I did, I went to the SITE, not the app-pool, of the WCF webservice, went into the Advanced settings erased net.tcp out of the enabled protocols, hit ok, which saved the setting, called the net.tcp service, and it of course gave me the stock exception...

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

I then re-added net.tcp into the enabled protocols. The web service then ran perfectly fine. I am not certain why this worked. I think it forced a reset of the TCP listener. I can not be certain however.


Have you seen this MSDN forums thread?

http://social.msdn.microsoft.com/Forums/en-US/wcf/thread/ec167e53-293c-4e7d-88a3-e5992db1ffd4/

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜