gpt4 book ai didi

WCF net.tcp 连接总是失败

转载 作者:行者123 更新时间:2023-12-04 06:08:22 24 4
gpt4 key购买 nike

我尝试使用 net.tcp 绑定(bind)设置用于测试的服务。我还设置了一个 http 端点。配置如下:

  <system.serviceModel>
<behaviors>
<endpointBehaviors>
<behavior name="Inbound_REST">
<webHttp />
</behavior>
</endpointBehaviors>
<serviceBehaviors>
<behavior name="InboundHttpConfiguration">
<serviceMetadata httpGetEnabled="true" />
<serviceDebug includeExceptionDetailInFaults="true" />
</behavior>
<behavior name="InboundTcpConfiguration">
<serviceMetadata httpGetEnabled="false" />
<serviceDebug includeExceptionDetailInFaults="true" />
</behavior>
</serviceBehaviors>
</behaviors>
<services>
<service behaviorConfiguration="InboundTcpConfiguration" name="Inbound">
<endpoint address="" binding="netTcpBinding" contract="IContract">
<identity>
<dns value="localhost"/>
</identity>
</endpoint>
<host>
<baseAddresses>
<add baseAddress="net.tcp://localhost:6969/Inbound" />
</baseAddresses>
</host>
</service>
</services>
<serviceHostingEnvironment multipleSiteBindingsEnabled="true" />
<client>
<endpoint name="httpEndPoint" address="http://localhost:1568/Inbound.svc" binding="basicHttpBinding" contract="IContract" />
<endpoint name="tcpEndPoint" address="net.tcp://localhost:6969/Inbound" binding="netTcpBinding" contract="IContract" />
</client>
<bindings>
<basicHttpBinding>
<binding name="httpbind">
<security mode="Transport">
<transport clientCredentialType="None"/>
</security>
</binding>
</basicHttpBinding>
<netTcpBinding>
<binding name="tcpbind">
<security mode="Transport">
<transport clientCredentialType="None" />
</security>
</binding>
</netTcpBinding>
</bindings>
</system.serviceModel>

当我尝试使用 net.tcp 绑定(bind)使用服务时,它总是返回错误:

无法连接到 net.tcp://localhost:6969/Inbound。连接尝试持续了 00:00:00.9531494 的时间跨度。 TCP 错误代码 10061:无法建立连接,因为目标机器主动拒绝 127.0.0.1:6969。

顺便说一句,http 绑定(bind)工作正常。我认为这可能是一些机器配置,但无法找到根本原因。

最佳答案

如果您尝试通过 Visual Studio 运行 WCF 服务,则不支持 netTcpBinding。对不起!

Check out this post for a more detailed explanation.

关于WCF net.tcp 连接总是失败,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8079090/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com