WCF 服务 netTCPbinding [英] WCF Service netTCPbinding

查看:19
本文介绍了WCF 服务 netTCPbinding的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想使用 netTCPbinding,所以我改变了我的 web 配置如下.我遇到了这个错误:

I want to use netTCPbinding, so I've changed my web config as below. I'm experiencing this error:

无法找到与绑定 NetTcpBinding 的端点的方案 net.tcp 匹配的基地址.注册的基地址方案是 [http].

Could not find a base address that matches scheme net.tcp for the endpoint with binding NetTcpBinding. Registered base address schemes are [http].

如何解决?

<services>
  <service name="DXDirectory.DXDirectoryService" behaviorConfiguration="DXDirectory.Service1Behavior">
    <!-- Service Endpoints -->
    <endpoint address="" binding="netTcpBinding" bindingConfiguration="WindowsSecured" contract="DXDirectory.IDXDirectoryService">
      <!-- 
          Upon deployment, the following identity element should be removed or replaced to reflect the 
          identity under which the deployed service runs.  If removed, WCF will infer an appropriate identity 
          automatically.
      -->
      <identity>
        <dns value="localhost" />
      </identity>
    </endpoint>
    <host>
      <baseAddresses>
        <add baseAddress="net.tcp://localhost:2582/DXDirectoryService" />
      </baseAddresses>
    </host>

  </service>
</services>
<behaviors>
  <serviceBehaviors>
    <behavior name="DXDirectory.Service1Behavior">
      <!-- To avoid disclosing metadata information, set the value below to false and remove the metadata endpoint above before deployment -->
      <serviceMetadata httpGetEnabled="false" />
      <!-- To receive exception details in faults for debugging purposes, set the value below to true.  Set to false before deployment to avoid disclosing exception information -->
      <serviceDebug includeExceptionDetailInFaults="false" />
      <serviceAuthorization principalPermissionMode="UseWindowsGroups" />
      <!--<serviceCredentials>-->
        <!--<userNameAuthentication userNamePasswordValidationMode="Custom"
                                membershipProviderName="CustomUserNameValidator"/>-->
      <!--</serviceCredentials>-->
    </behavior>
  </serviceBehaviors>
</behaviors>

推荐答案

嗯...您已经将基地址添加到您的服务/主机部分 ok.

HMm... you've added the base address to your services/host section ok.

快速问题:您是自托管还是在 IIS 中托管?哪个版本的IIS??

Quick question: are you self-hosting, or hosting in IIS ?? Which version of IIS ??

IIS5/6 仅支持 HTTP 连接 - 您不能在 IIS 5/6 中托管 NetTCP.

IIS5/6 only support HTTP connections - you cannot host a NetTCP in IIS 5/6.

在 IIS7 中,您必须手动执行一系列步骤才能启用非 HTTP 绑定,但这是可能的.请参阅这篇 MSDN 文章,了解如何实现这一点.

In IIS7, you have to manually go through a series of steps to enable non-HTTP bindings, but it's possible. See this MSDN article on how to achieve this.

自托管是最佳选择 - 您获得所有绑定并完全控制托管的服务.

Self-hosting is the best option - you get all bindings and are in total control of your service being hosted.

马克

这篇关于WCF 服务 netTCPbinding的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆