【发布时间】:2013-10-01 04:59:51
【问题描述】:
我是创建 WCF 服务的新手。我在 IIS 7 上运行的 VS2008 中创建了 WCF Web 服务。当我使用 http 时,该服务运行良好。当我为 TCP 配置服务并运行时,我收到以下错误消息。
通信出现问题。这 无法发送消息 因为端点的服务 地址 'net: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>
【问题讨论】: