Back

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

Language 中文 English

Originally WCF only used < BasicHttpBinding >, now added net.tcp protocol. After adding server reported error Could not find a base address that matches scheme net.tcp for the endpoint with binding NetTcpBinding. Registered base address schemes are [http]., checked Web.config and website configuration still reported error. Finally referred to WCF: How to host net.tcp protocol to IIS, in Website->Binding->Add net.tcp protocol, situation solved. Image Description Image Description If just starting configuration, don’t forget to add net.tcp protocol in advanced settings Image Description

Web.config configuration file

<?xml version="1.0" encoding="utf-8"?>
<configuration>

  <appSettings>
    <add key="aspnet:UseTaskFriendlySynchronizationContext" value="true"/>
  </appSettings>
  <system.web>
    <compilation debug="true" targetFramework="4.6.1"/>
    <httpRuntime targetFramework="4.6.1"/>
  </system.web>
  <system.serviceModel>
    <bindings>
      <netTcpBinding>
        <binding name="NetTcpBinding" maxBufferSize="2147483647" maxReceivedMessageSize="2147483647" sendTimeout="00:30:00" transferMode="Streamed">
          <security mode="None"/>
        </binding>
      </netTcpBinding>
    </bindings>

    <services>
      <service name="WcfMySqlService.MysqlInfo">
        <endpoint address="" binding="netTcpBinding" bindingConfiguration="NetTcpBinding" contract="WcfMySqlService.IMysqlInfo">
          <identity>
            <dns value="localhost"/>
          </identity>
        </endpoint>
        <endpoint address="mex" binding="mexTcpBinding" contract="IMetadataExchange"/>
        <host>
          <baseAddresses>
            <add baseAddress="http://localhost:8084/WcfMysqlService/MysqlInfo.svc"/>
            <add baseAddress="net.tcp://localhost:8084/WcfMysqlService/MysqlInfo.svc"/>
          </baseAddresses>
        </host>
      </service>
    </services>


    <behaviors>
      <serviceBehaviors>
        <behavior>
          <!-- To avoid disclosing metadata information, set the values below to false before deployment -->
          <serviceMetadata httpGetEnabled="true" httpsGetEnabled="true"/>
          <!-- 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>
      <protocolMapping>
        <add binding="basicHttpsBinding" scheme="https"/>
        <add scheme="net.tcp" binding="netTcpBinding" />
    </protocolMapping>  
    <serviceHostingEnvironment aspNetCompatibilityEnabled="true" multipleSiteBindingsEnabled="true"/>
  </system.serviceModel>
  <system.webServer>
    <modules runAllManagedModulesForAllRequests="true"/>
    <!--
        To browse web app root directory during debugging, set the value below to True.
        Set this value to False before deployment to avoid disclosing web app folder information.
      -->
    <directoryBrowse enabled="true"/>
  </system.webServer>

	<runtime>
		<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
			<dependentAssembly>
				<assemblyIdentity name="System.Buffers" publicKeyToken="CC7B13FFCD2DDD51" culture="neutral"/>
				<bindingRedirect oldVersion="0.0.0.0-4.0.3.0" newVersion="4.0.3.0"/>
			</dependentAssembly>
		</assemblyBinding>
	</runtime>
</configuration>