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

  • Question

  • Hi,

    I'm trying to use NetTcpBinding in my WCF service but when i try to run my service with NetTcpBinding, i receive the following error as mentioned below:

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

    Please let me know what is wrong here.

    Thanks.


    Cheers, Vivek YJA
    Saturday, June 12, 2010 12:50 PM

Answers

  • If you are hosting the service yourself (using the ServiceHost class), make sure you have a TCP base address, in addition to the HTTP one:

        [ServiceContract]
        public interface ITest
        {
            [OperationContract]
            string Echo(string value);
        }

        public class Service : ITest
        {
            public string Echo(string value) { return value; }
        }

        public class Host
        {
            public static void Test()
            {
                string baseAddress = "http://" + Environment.MachineName + ":8000/Service";
                string baseAddressTcp = "net.tcp://" + Environment.MachineName + ":8008/Service";
                ServiceHost host = new ServiceHost(typeof(Service), new Uri(baseAddress), new Uri(baseAddressTcp));
                host.AddServiceEndpoint(typeof(ITest), new BasicHttpBinding(), "");
                host.AddServiceEndpoint(typeof(ITest), new NetTcpBinding(SecurityMode.None), "");
                host.Description.Behaviors.Add(new ServiceMetadataBehavior { HttpGetEnabled = true });
                host.Open();
                Console.WriteLine("Host opened, press ENTER to close");
                Console.ReadLine();
            }
        }

    If you are hosting the service under IIS (WAS), you need to have a few things enabled:

    • Windows Communication Foundation Non-HTTP Activation feature: on IIS7.5 on Windows 7 / Windows Server 2008, you can do it at the control panel / programs / turn windows features on or off / microsoft .net framework
    • On the application under IIS where the service is running, make sure that net.tcp is one of the protocols which is enabled: select the application/vdir, choose "advanced settings", and on "enabled protocols" put "http,net.tcp"
    Saturday, June 12, 2010 1:25 PM