我有一个服务有两个我想用于tcp绑定的合约。服务配置文件是这样的:wcf tcp:错误10061
<system.serviceModel>
<bindings>
<netTcpBinding>
<binding name="ServiceDocumentos" transferMode="Streamed"
maxBufferSize="67108864"
maxReceivedMessageSize="67108864" maxBufferPoolSize="67108864"
closeTimeout="00:00:10"
openTimeout="00:00:10" receiveTimeout="00:20:00"
sendTimeout="00:01:00" maxConnections="100"/>
<binding name="ServiceCore" transferMode="Buffered"
maxBufferSize="67108864"
maxReceivedMessageSize="67108864" maxBufferPoolSize="67108864"
closeTimeout="00:00:10"
openTimeout="00:00:10" receiveTimeout="00:20:00"
sendTimeout="00:01:00" maxConnections="100"/>
</netTcpBinding>
<basicHttpBinding>
<binding name="ServiceDocumentos" messageEncoding="Mtom" transferMode="Streamed" />
<binding name="ServiceCore" messageEncoding="Mtom" transferMode="Buffered" />
</basicHttpBinding>
<wsDualHttpBinding>
<binding name="ServiceDocumentos" messageEncoding="Mtom"/>
<binding name="ServiceCore" messageEncoding="Mtom"/>
</wsDualHttpBinding>
</bindings>
<services>
<service behaviorConfiguration="CMMSService" name="GTS.CMMS.Service.Service">
<endpoint binding="netTcpBinding" bindingConfiguration="ServiceDocumentos"
name="ServiceDocumentos" contract="GTS.CMMS.Service.IServiceDocumentos"
address="ServiceDocumentos/">
<identity>
<dns value="localhost" />
</identity>
</endpoint>
<endpoint address ="net.tcp://localhost:6000/CMMSService/ServiceCore/"
binding="netTcpBinding" bindingConfiguration="ServiceCore"
name="ServiceCore" contract="GTS.CMMS.Service.IService">
<identity>
<dns value="localhost" />
</identity>
</endpoint>
<endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange"
listenUriMode="Explicit">
</endpoint>
<host>
<baseAddresses>
<add baseAddress="http://localhost:8500/CMMSService" />
<add baseAddress="net.tcp://localhost:8501/CMMSService" />
</baseAddresses>
</host>
</service>
</services>
<behaviors>
<serviceBehaviors>
<behavior name="CMMSService">
<serviceMetadata httpGetEnabled="True"/>
<serviceDebug includeExceptionDetailInFaults="True" />
</behavior>
</serviceBehaviors>
</behaviors>
</system.serviceModel>
而且客户端配置文件是:
<system.serviceModel>
<bindings>
<netTcpBinding>
<binding name="ServiceDocumentos" closeTimeout="00:01:00" openTimeout="00:01:00"
receiveTimeout="00:10:00" sendTimeout="00:01:00" hostNameComparisonMode="StrongWildcard"
maxBufferSize="3670016" maxBufferPoolSize="524288" maxReceivedMessageSize="3670016"
transferMode="Streamed">
<readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="65536"
maxBytesPerRead="4096" maxNameTableCharCount="16384" />
</binding>
<binding name="ServiceCore" closeTimeout="00:01:00" openTimeout="00:01:00"
receiveTimeout="00:10:00" sendTimeout="00:01:00" hostNameComparisonMode="StrongWildcard"
maxBufferSize="2097152" maxBufferPoolSize="524288" maxReceivedMessageSize="2097152"
transferMode="Buffered">
<readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="65536"
maxBytesPerRead="4096" maxNameTableCharCount="16384" />
<security mode="None">
<transport clientCredentialType="None" />
<message clientCredentialType="UserName" algorithmSuite="Default" />
</security>
</binding>
</netTcpBinding>
<basicHttpBinding>
<binding name="ServiceDocumentos" closeTimeout="00:01:00" openTimeout="00:01:00"
receiveTimeout="00:10:00" sendTimeout="00:01:00" allowCookies="false"
bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard"
maxBufferSize="3670016" maxBufferPoolSize="524288" maxReceivedMessageSize="3670016"
messageEncoding="Mtom" textEncoding="utf-8" transferMode="Streamed"
useDefaultWebProxy="true">
<readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="65536"
maxBytesPerRead="4096" maxNameTableCharCount="16384" />
</binding>
<binding name="ServiceCore" closeTimeout="00:01:00" openTimeout="00:01:00"
receiveTimeout="00:10:00" sendTimeout="00:01:00" allowCookies="false"
bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard"
maxBufferSize="2097152" maxBufferPoolSize="524288" maxReceivedMessageSize="2097152"
messageEncoding="Mtom" textEncoding="utf-8" transferMode="Buffered"
useDefaultWebProxy="true">
<readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="65536"
maxBytesPerRead="4096" maxNameTableCharCount="16384" />
<security mode="None">
<transport clientCredentialType="None" proxyCredentialType="None"
realm="" />
<message clientCredentialType="UserName" algorithmSuite="Default" />
</security>
</binding>
</basicHttpBinding>
<wsDualHttpBinding>
<binding name="ServiceDocumentos" messageEncoding="Mtom"/>
<binding name="ServiceCore" messageEncoding="Mtom"/>
</wsDualHttpBinding>
</bindings>
<client>
<!--<endpoint address="net.tcp://localhost:8501/CMMSService/ServiceDocumentos/"
binding="netTcpBinding" bindingConfiguration="ServiceDocumentos"
contract="IServiceDocumentos" name="ServiceDocumentos" />
<endpoint address="net.tcp://localhost:8501/CMMSService/ServiceCore/"
binding="netTcpBinding" bindingConfiguration="ServiceCore"
contract="IService" name="ServiceCore" />-->
<endpoint address="net.tcp://localhost:8501/CMMSService/ServiceDocumentos/"
binding="netTcpBinding" bindingConfiguration="ServiceDocumentos"
contract="IServiceDocumentos" name="ServiceDocumentos" />
<endpoint address="net.tcp://localhost:6000/CMMSService/ServiceCore/"
binding="netTcpBinding" bindingConfiguration="ServiceCore"
contract="IService" name="ServiceCore" />
</client>
</system.serviceModel>
我做不同的绑定测试。例如,如果对于一个合同,IServiceDocumentos使用tcp,对于其他合同,我使用wsDualHttpBinding的主合同,所有工作都正常。我可以使用这两份合约。
如果我使用TCP两份合约,然后我得到的错误TCP 10061
我尝试使用一个单独的完整地址,每项合同,因为我想这个问题可能是使用相同的端口,但问题仍然存在。但是,如果我为每个端点使用完整的单独地址,那么如果我使用不同的绑定,则该方法有效。
此外,我尝试星级服务tcp端口共享(在Windows XP中的服务),并没有解决问题。
我试图禁用防火墙,但是这不能解决问题。
谢谢。
编辑:
我使用follwing命令时,我有服务运行:
netstat -ona || find "6000"
我得到以下信息:
TCP 0.0.0.0:6000 0.0.0.0 LISTENING 2690
所以我认为por是打开和听。
错误'10061'是“连接被拒绝”('WSAECONNREFUSED')。这意味着您尝试连接的计算机不在监听。应用程序是否在该计算机上运行? –