繁体   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