Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6344793
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T20:42:36+00:00 2026-05-24T20:42:36+00:00

I have an application using discovery that may be deployed locally on the same

  • 0

I have an application using discovery that may be deployed locally on the same PC or remote from the service it consumes. Is there any way to expose the named pipe binding via WCF discovery? If not I suppose I can negotiate after the service is discovered to determine the most suitable binding.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-24T20:42:37+00:00Added an answer on May 24, 2026 at 8:42 pm

    Yes, it’s possible to do that. But since the address will be listed as “localhost” (the only possible address for net.pipe), you’ll likely need some sort of test to verify that the service is actually running on the same machine as the discovery client.

    public class StackOverflow_7068743
    {
        [ServiceContract]
        public interface ITest
        {
            [OperationContract]
            string Echo(string text);
        }
        public class Service : ITest
        {
            public string Echo(string text)
            {
                return text + " (via " + OperationContext.Current.IncomingMessageHeaders.To + ")";
            }
        }
        public static void Test()
        {
            string baseAddressHttp = "http://" + Environment.MachineName + ":8000/Service";
            string baseAddressPipe = "net.pipe://localhost/Service";
            ServiceHost host = new ServiceHost(typeof(Service), new Uri(baseAddressHttp), new Uri(baseAddressPipe));
            host.Description.Behaviors.Add(new ServiceDiscoveryBehavior());
            host.AddServiceEndpoint(new UdpDiscoveryEndpoint());
            host.AddServiceEndpoint(typeof(ITest), new BasicHttpBinding(), "");
            host.AddServiceEndpoint(typeof(ITest), new NetNamedPipeBinding(NetNamedPipeSecurityMode.None), "");
            host.Open();
            Console.WriteLine("Host opened");
    
            DiscoveryClient discoveryClient = new DiscoveryClient(new UdpDiscoveryEndpoint());
            FindResponse findResponse = discoveryClient.Find(new FindCriteria(typeof(ITest)));
            Console.WriteLine(findResponse.Endpoints.Count);
    
            EndpointAddress address = null;
            Binding binding = null;
            foreach (var endpoint in findResponse.Endpoints)
            {
                if (endpoint.Address.Uri.Scheme == Uri.UriSchemeHttp)
                {
                    address = endpoint.Address;
                    binding = new BasicHttpBinding();
                }
                else if (endpoint.Address.Uri.Scheme == Uri.UriSchemeNetPipe)
                {
                    address = endpoint.Address;
                    binding = new NetNamedPipeBinding(NetNamedPipeSecurityMode.None);
                    break; // this is the preferred
                }
    
                Console.WriteLine(endpoint.Address);
            }
    
            if (binding == null)
            {
                Console.WriteLine("No known bindings");
            }
            else
            {
                ChannelFactory<ITest> factory = new ChannelFactory<ITest>(binding, address);
                ITest proxy = factory.CreateChannel();
                Console.WriteLine(proxy.Echo("Hello"));
                ((IClientChannel)proxy).Close();
                factory.Close();
            }
    
            Console.Write("Press ENTER to close the host");
            Console.ReadLine();
            host.Close();
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an application that's using Oracle.DataAccess to connect. I've already discovered that the
I have a Php application using stream_socket_client(), to get data through tcp from a
I'm trying to enable service discovery in my client-server application using JmDNS. I fully
I have an application using Core Data and bindings. I want to have an
We have an application using the IBM Informix driver. Whenever we try to open
I have a web application using ASP.NET 2.0 and I want to know if
I have a control application - using asp.net webservices. I have a timer which
I have a web application using JPA and JTA with Spring. I would like
I have a WPF application using Aero Glass. When using the application under a
I have a simple application using netbeans for developing and maven for building et

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.