【发布时间】:2011-07-26 16:39:26
【问题描述】:
我正在学习 WCF,并首先使用 wsHttpBinding 开发了一项服务,并将其托管在 IIS7 (win7) 上,并从 Windows 客户端应用程序中使用了该服务。它工作正常(使用 WCF 服务 DLL 方法)
我尝试有两个端点并添加了netTCpBinding。我遇到错误
{TransportManager 未能使用 NetTcpPortSharing 服务:无法启动该服务,因为它是 禁用。
我已经启动了所需的服务,甚至重新启动了我的机器。在“服务”中,这 2 个服务显示为已启动。我已经在 IIS 中启用了所需的 tcpnetbinding 设置,正如许多博客和 msdn 所告知的那样。
我的客户端应用配置是这样的:
<configuration>
<system.serviceModel>
<bindings />
<client>
<endpoint name="httpEndpoint"
address="http://MachineName:8000/FLOW5WCFService.svc"
binding="wsHttpBinding"
contract="FLOW5ServiceDLL.IFLOW5WCFService"/>
<endpoint name="tcpEndpoint"
address="net.tcp://MachineName:8082/FLOW5WCFService.svc"
binding="netTcpBinding"
contract="FLOW5ServiceDLL.IFLOW5WCFService"/>
</client>
</system.serviceModel>
</configuration>
服务web.config:
<configuration>
<system.serviceModel>
<bindings>
<netTcpBinding>
<binding name="tcpBinding"
portSharingEnabled="true"
closeTimeout="00:10:00" openTimeout="00:10:00"
receiveTimeout="00:10:00" sendTimeout="00:10:00" transactionFlow="true"
hostNameComparisonMode="StrongWildcard" maxBufferPoolSize="524288"
maxReceivedMessageSize="2147483647">
<readerQuotas maxDepth="32" maxStringContentLength="2147483647"
maxArrayLength="2147483647" maxBytesPerRead="4096"
maxNameTableCharCount="320000" />
</binding>
</netTcpBinding>
</bindings>
<services>
<service behaviorConfiguration="FLOW5ServiceDLL.FLOW5WCFServiceBehaviour"
name="FLOW5ServiceDLL.FLOW5WCFService">
<endpoint
address=""
binding="wsHttpBinding"
contract="FLOW5ServiceDLL.IFLOW5WCFService">
<identity>
<dns value="localhost" />
</identity>
</endpoint>
<endpoint
binding="netTcpBinding"
bindingConfiguration="tcpBinding"
contract="FLOW5ServiceDLL.IFLOW5WCFService"/>
<endpoint
address="mex"
binding="mexHttpBinding"
contract="IMetadataExchange" />
<host>
<baseAddresses>
<add baseAddress="http://localhost:8000/" />
<add baseAddress="net.tcp://localhost:8082" />
</baseAddresses>
</host>
</service>
</services>
<behaviors>
<serviceBehaviors>
<behavior name="FLOW5ServiceDLL.FLOW5WCFServiceBehaviour">
<serviceMetadata httpGetEnabled="false" />
<serviceDebug includeExceptionDetailInFaults="false" />
</behavior>
</serviceBehaviors>
</behaviors>
</system.serviceModel>
<system.web>
<compilation debug="false" />
</system.web>
</configuration>
我正在我的客户端代码中创建一个频道,如下所示
ChannelFactory<IFLOW5WCFService> protocolFactory
= new ChannelFactory<IFLOW5WCFService>("tcpEndpoint");
l_oFLOW5Service = protocolFactory.CreateChannel();
如果我的配置错误或者我需要做任何其他设置,谁能告诉我?如果需要更多信息,请告诉我
提前致谢
【问题讨论】:
-
还有人需要更多信息吗?没有答案!! ..请让我知道,以防有人发现更多事情要做..
标签: c# .net wcf wcf-binding