【问题标题】:WCF Service netTCPbindingWCF 服务网络TCPbinding
【发布时间】:2010-11-24 07:29:37
【问题描述】:

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

找不到与具有绑定 NetTcpBinding 的端点的方案 net.tcp 匹配的基地址。注册的基地址方案是 [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>

【问题讨论】:

标签: wcf web-services wcf-binding


【解决方案1】:

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

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

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

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

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

马克

【讨论】:

  • 我正在使用自托管和 IIS 7
  • 对不起,马克,我使用的是 IIS 5.1
  • 正如我所提到的 - IIS5 将 与 NetTCP 绑定一起工作 - 在这种情况下您需要使用自托管。你在自托管中是否也有同样的错误?
【解决方案2】:

这是来自 msdn 的 NetTcpBinding 基本示例。看看这是否可以帮助你。

编辑:

here 是一个相关的 SO 问题。

【讨论】:

    【解决方案3】:

    我在您的配置文件中看不到部分,请问您可以吗 请添加这个

    <netTcpBinding>
    
     <binding name="WindowsSecured">
     <security mode="none"/> 
     </binding> 
    
    </netTcpBinding>
    

    【讨论】:

      猜你喜欢
      • 2015-02-11
      • 2010-10-23
      • 1970-01-01
      • 2012-02-27
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多