首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >WCF net.tcp连接总是失败

WCF net.tcp连接总是失败
EN

Stack Overflow用户
提问于 2011-11-10 11:53:22
回答 3查看 3.4K关注 0票数 2

我试图设置一个使用net.tcp绑定进行测试的服务。我还设置了一个http端点。配置如下:

代码语言:javascript
复制
  <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绑定使用服务时,它总是返回错误:

无法连接到net.tcp://localhost:6969/入站。连接尝试持续时间为00:00:00.9531494。TCP错误代码10061:无法连接,因为目标机器主动拒绝它127.0.0.1:6969。

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

EN

回答 3

Stack Overflow用户

回答已采纳

发布于 2011-11-10 21:12:30

如果您试图通过visual studio运行WCF服务,则不支持netTcpBinding。抱歉的!

请查看这篇文章,了解更详细的解释。

票数 3
EN

Stack Overflow用户

发布于 2011-11-10 13:07:46

为什么您省略了客户端net.tcp地址的“net.tcp”?也许应该是“net.tcp://localhost:6969/In量.6969”

票数 0
EN

Stack Overflow用户

发布于 2011-11-10 13:32:50

什么托管您是using..IIS7或控制台或其他?

1)检查所有tcp服务是否运行在services.msc中。

2)关闭防火墙或向tcp端口添加防火墙异常

如果您正在iis7中托管,请检查此链接

IIS7对非http协议的支持

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/8079090

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档