我是创建WCF服务的新手。我已经在IIS 7上运行的VS2008中创建了一个WCF Web服务。当我使用http时,该服务工作正常。当我为TCP配置服务并运行时,我收到以下错误消息。
存在沟通问题。该 消息无法分派 因为端点上的服务 地址 净:TCP:// ELEC:9090 / CoordinateIdTool_Tcp / IdToolService.svc 不适用于协议 地址。
我搜索了很多论坛,包括这个论坛,但是没有任何效果。似乎在IIS 7上正确设置了所有内容.WAS已设置为运行。默认网站具有net.tcp绑定,并且应用程序在启用的协议下具有net.tcp。
我包含了我认为来自主机项目的web.config的重要部分,以及我用来测试服务的客户端项目中的app.config。希望有人能发现我的错误。提前感谢任何人提供的任何帮助或建议。
的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>
答案 0 :(得分:2)
我认为我的问题与你的问题类似。我做了什么,我去了WITE网络服务的网站,而不是应用程序池,进入高级设置擦除启用协议的net.tcp,点击确定,保存设置,称为net.tcp服务,它当然给了我股票例外...
Could not find a base address that matches scheme net.tcp for the endpoint with binding NetTcpBinding. Registered base address schemes are [http].
然后我将net.tcp重新添加到启用的协议中。然后,Web服务运行得非常好。 我不确定为什么会这样。我认为它强制重置TCP侦听器。但我无法确定。
答案 1 :(得分:0)