WCF服务netTCP绑定

8
我想要使用netTCPbinding,所以我已将我的web config更改如下。 我遇到了这个错误:
“无法找到与绑定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 中的 NetTcpBinding... 请访问此链接,它包含大量信息... http://www.planetofcoders.com/nettcpbinding-in-wcf/ - Gaurav Agrawal
3个回答

5

嗯...你已经将基础地址添加到了服务/主机部分,很好。

快速提问:你是自己托管还是在IIS中托管??使用的是哪个版本的IIS??

IIS5/6仅支持HTTP连接-无法在IIS 5/6中托管NetTCP。

在IIS7中,您必须手动通过一系列步骤启用非HTTP绑定,但这是可能的。请参见此MSDN文章以了解如何实现此操作。

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

Marc


我正在使用自托管和IIS 7。 - Ashish Ashu
抱歉,Marc,我正在使用IIS 5.1。 - Ashish Ashu
正如我之前提到的 - IIS5将无法使用NetTCP绑定 - 在这种情况下,您需要使用自托管。在自托管中是否也有相同的错误? - marc_s

4

这是来自 msdn 的 NetTcpBinding 基本示例。看看它是否能帮到你。

编辑:

这里 有一个相关的 SO 问题。


0

我在您的配置文件中找不到该部分,请您添加一下。

<netTcpBinding>

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

</netTcpBinding>


网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接