我有一個服務有兩個我想用於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')。這意味着您嘗試連接的計算機不在監聽。應用程序是否在該計算機上運行? –