WCF Service netTCPbinding

Ashish Ashu picture Ashish Ashu · Aug 31, 2009 · Viewed 30.7k times · Source

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

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

How can this be solved?

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

Answer

marc_s picture marc_s · Aug 31, 2009

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

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

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

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.

Marc