簡體   English   中英

WCF嘗試公開nettcp端點; TCP錯誤代碼10061:無法建立連接,因為目標計算機主動拒絕它

[英]WCF trying to expose a nettcp endpoint; TCP error code 10061: No connection could be made because the target machine actively refused it

我不明白這里的問題是什么。 我的wsHttpBinding運行正常。 這是我的配置。 任何幫助最受贊賞。

<?xml version="1.0"?>
<configuration>
  .....
  <system.serviceModel>
    <services>
      <service behaviorConfiguration="DataService.Service1Behavior"
               name="ODHdotNET.DataService">
        <endpoint 
               address="" 
               binding="wsHttpBinding" 
               bindingConfiguration="largeTransferwsHttpBinding"
               contract="ODHdotNET.IDataService">
          <identity>
            <dns value="localhost" />
          </identity>
        </endpoint>
        <endpoint 
            address="net.tcp://139.149.141.221:8001/DataService.svc" 
            binding="netTcpBinding" 
            contract="ODHdotNET.IDataService"/>
        <endpoint 
            address="mex" 
            binding="mexHttpBinding" 
            contract="IMetadataExchange" />
        <host>
          <baseAddresses>
            <add baseAddress="http://139.149.141.221:8000/DataService.svc" />
          </baseAddresses>
        </host>
      </service>
    </services>
    <bindings>
      <wsHttpBinding>
        <binding name="largeTransferwsHttpBinding2" 
                 maxReceivedMessageSize="5000000" maxBufferPoolSize="5000000">
          <security mode ="Message">
            <message clientCredentialType="UserName"/>
          </security>
        </binding>
        <binding name="largeTransferwsHttpBinding" 
                 maxReceivedMessageSize="5000000" maxBufferPoolSize="5000000" />
      </wsHttpBinding>
     </bindings>
    <behaviors>
      <serviceBehaviors>
        <behavior name="DataService.Service1Behavior">
          <serviceMetadata httpGetEnabled="true"/>
          <serviceDebug includeExceptionDetailInFaults="true"/>
        </behavior>
      </serviceBehaviors>
    </behaviors>
  </system.serviceModel>
</configuration>

編輯:我在Windows服務中自托管; 我沒有使用IIS。

你的意思是WCF客戶端拋出此錯誤? 如果是這樣的話:請在命令提示符下運行:netstat -ona | 找到“8001”如果返回數據,請發布

您需要向IIS添加TCP支持。 要專門啟用TCP,MSMQ或命名管道通信,請執行配置對關聯協議的支持的附加步驟。 對於TCP通信,請使用Appcmd命令行實用程序將默認網站綁定到net.tcp端口。 Appcmd是一個IIS實用程序,使您可以管理虛擬站點,目錄,應用程序和應用程序池。

%windir%\system32\inetsrv\appcmd.exe set site "Default Web Site" -
+bindings.[protocol='net.tcp',bindingInformation='808:*']

要支持其他協議,請運行其他命令以啟用默認網站的這些協議。 此時,您已在站點級別配置net.tcp協議。

%windir%\system32\inetsrv\appcmd.exe set app "Default Web Site/OrderServiceHost"
/enabledProtocols:http,net.tcp

請查看這些以獲取更多詳細信息: 使用WAS擴展超出HTTP的WCF服務

在Windows激活服務中托管WCF服務

在客戶端應用程序中調用方法時,請確保主機正在運行。

確保端口在Windows防火牆中打開

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM