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

时间:2013-09-02 14:28:42

标签: wcf net.tcp

我一直在使用http来处理所有这些,当我使用net.tcp时和添加引用时我收到的错误如

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

我的web.config

<?xml version="1.0"?>
<configuration>

  <system.web>
    <compilation debug="true" targetFramework="4.0" />
  </system.web>
  <system.serviceModel>
    <services>
      <service behaviorConfiguration="servicebehave" name="WcfServ.Service1">
        <endpoint address="" binding="netTcpBinding" 
          bindingConfiguration="" name="nettcp" contract="WcfServ.IService1" />

        <endpoint address="mex" binding="mexTcpBinding" bindingConfiguration=""
          name="mex" contract="IMetadataExchange" />
        <host>
          <baseAddresses>
            <add baseAddress="net.tcp://localhost:51560/Service1.svc" />
           <add baseAddress="http://localhost:8080/Service1.svc"/>
          </baseAddresses>
        </host>
      </service>
    </services>
    <bindings>
      <netTcpBinding>
        <binding name="netTcpBinding">
          <security mode="Transport" />
        </binding>
      </netTcpBinding>

    </bindings>
    <behaviors>
      <serviceBehaviors>
        <behavior name="servicebehave">
          <!-- 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"/>

        </behavior>
      </serviceBehaviors>
    </behaviors>
    <serviceHostingEnvironment multipleSiteBindingsEnabled="false" />
  </system.serviceModel>
 <system.webServer>
    <modules runAllManagedModulesForAllRequests="true"/>
  </system.webServer>

</configuration>

有谁能告诉我我哪里做错了?

2 个答案:

答案 0 :(得分:1)

您无法在IIS 6下托管net.tcp,它仅支持HTTP(s)。所以你只受限于HTTP绑定(基本,ws或2007)。为了提供net.tcp和其他协议,需要WAS。您可以单独激活它,但我建议您使用IIS 7安装它(它作为其中的一部分安装),因为IIS 7还提供了一个方便的服务管理平台。

它使用支持tcp协议的ServiceHost类实例更改托管环境以使其自托管或服务托管的另一种解决方案。

答案 1 :(得分:0)

如果要在 IIS 7 中为net.tcp配置wcf服务,请参阅以下答案:

WCF Service Base Address Http and netTcp

此致