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

断了今生、忘了曾经 提交于 2020-01-16 18:09:47

问题


I have been using http for all these and when i am working with net.tcp and when adding the reference i am getting an error like

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

my 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>

Can anybody tell me where i am doing wrong?


回答1:


You can't host net.tcp under IIS 6, it supports only HTTP(s). So you are limited with HTTP bindings only (basic, ws or 2007). In order to provide net.tcp and other protocols, WAS is required. You can activate it standalone, but I advice you to install it both with IIS 7 (it is installed as a part of it), because IIS 7 gives a convinient service management platform in addition.

Another solution it so change the hosting environment to make it self-hosted or service-hosted, using ServiceHost class instance, which supports tcp protocol.




回答2:


If you want to configure your wcf service for net.tcp in IIS 7 please refer to this answer:

WCF Service Base Address Http and netTcp

Regards



来源:https://stackoverflow.com/questions/18575496/could-not-find-a-base-address-that-matches-scheme-net-tcp-for-the-endpoint-with

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!