繁体   English   中英

无法为net.tcp WCF服务添加服务客户端

[英]Unable to add service client for a net.tcp WCF service

我正在尝试为基于net.tcp的WCF服务添加客户端。 当我使用“添加服务参考”并提供以下URL: net.tcp://localhost/service1.svc时 ,出现以下错误。

无法识别URI前缀。 元数据包含无法解析的引用:“ net.tcp://localhost/service1.svc”。 无法连接到net.tcp://localhost/service1.svc。 连接尝试持续时间为00:00:02.0051147。 TCP错误代码10061:无法建立连接,因为目标计算机主动拒绝它127.0.0.1:808。 无法建立连接,因为目标计算机主动拒绝了该连接127.0.0.1:808如果在当前解决方案中定义了服务,请尝试构建解决方案并再次添加服务引用。

我检查了Windows组件中的WCF非HTTP服务,但是已经安装了它们。 这很简单:

为WCF服务启用非HTTP协议

如您所见,它们是为.NET 3.5.1安装的,而我的服务是在.NET 4.5中构建的。 这是问题吗? 我应该如何解决呢? 因为Windows组件列表中没有.NET 4.5的选项。

以下是我的WCF服务的配置:

<system.serviceModel>
<services>
<service name="CoreService.Service1" behaviorConfiguration="beh1">
  <host>
    <baseAddresses>
      <add baseAddress="net.tcp://localhost/Service1.svc"/>
    </baseAddresses>
  </host>
        <endpoint
     binding="netTcpBinding"
     bindingConfiguration="ultra"
     contract="CoreService.IAccountService"/>
       <endpoint
     binding="netTcpBinding"
     bindingConfiguration="ultra"
     contract="CoreService.ICategoryService"/>
         <endpoint
     binding="netTcpBinding"
     bindingConfiguration="ultra"
     contract="CoreService.ICommonService"/>
         <endpoint
     binding="netTcpBinding"
     bindingConfiguration="ultra"
     contract="CoreService.IFollowerService"/>
         <endpoint
     binding="netTcpBinding"
     bindingConfiguration="ultra"
     contract="CoreService.IInterestService"/>
<endpoint
     binding="netTcpBinding"
     bindingConfiguration="ultra"
     contract="CoreService.IInviteService"/>

  <endpoint
          address="mex"
          binding="mexTcpBinding"
          contract="IMetadataExchange"/>
</service>
</services>
<bindings>
<netTcpBinding>
<binding name="ultra"
     maxBufferPoolSize="2147483647"
     maxBufferSize="2147483647"
     maxConnections="2147483647"
     maxReceivedMessageSize="2147483647"
     portSharingEnabled="false"
     transactionFlow="false"
     listenBacklog="2147483647"
     sendTimeout="00:01:00">
<security mode="None">
<message clientCredentialType="None"/>
<transport protectionLevel="None" clientCredentialType="None"/>
</security>
<reliableSession enabled="false"/>
</binding>
</netTcpBinding>
</bindings>
<behaviors>
    <serviceBehaviors>
      <behavior name="beh1">
        <serviceMetadata httpGetEnabled="true" />
        <serviceDebug includeExceptionDetailInFaults="True" />
        <dataContractSerializer maxItemsInObjectGraph="65536" />
      </behavior>
    </serviceBehaviors>
  </behaviors>
</system.serviceModel>

WCF HTTP或非HTTP激活功能与您的服务之间似乎不存在兼容性问题。

据我说,IIS中缺少配置或配置错误,这可以解释连接被拒绝的原因。 要使用net.tcp正确配置IIS,请在此处查看

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM