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 8071049
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T13:34:41+00:00 2026-06-05T13:34:41+00:00

Need a way for one service on a well-known Endpoint to return strings which

  • 0

Need a way for one service on a well-known Endpoint to return strings which are relative addresses. The client can then connect to Endpoints using these relative addresses.
Clearly this resembles REST in some ways, but in this case running a Windows Service using NetNamedPipeBinding for IPC, so no need for HTTP.

Don’t want to create the Endpoint ahead of time since there will be a potentially large number of relative addresses, only some of which the client would be interested in.

All Contracts are known in advance.

Tried to find a solution with AddressFilterMode but wasn’t sure how to provision new Binding so that client connected to it, UriTemplate but don’t want to use the HTTP framework. Haven’t looked into RoutingService because constrained to .Net 3.5.

Pseudocode for client would be something like that below…

namespace Testing
{
    class RunTest
    {
        static void Test()
        {
            NetNamedPipeBinding namedpipe = new NetNamedPipeBinding();
            ChannelFactory<Contracts.IRoot> factoryRoot =
                new ChannelFactory<Contracts.IRoot>(
                namedpipe
                , new EndpointAddress("net.pipe://localhost/root");
            );
            Contracts.IRoot root = factoryRoot.CreateChannel();
            ICommunicationObject commsRoot = root as ICommunicationObject;
            commsRoot.Open();

            // Service examines address and creates Endpoint dynamically.
            string address = root.SomeFunctionWhichGetsARelativeAddress();

            // IBar service routes endpoint requests internally based on
            // "address" variable.
            ChannelFactory<Contracts.IBar> factoryBar = 
                new ChannelFactory<Contracts.IBar>(
                namedpipe
                , new EndpointAddress("net.pipe://localhost/root/IBar/" +
                                       address)
            );
            Contracts.IBar bar = factoryBar.CreateChannel();
            bar.DoSomething();
        }
    } // Ends class RunTest
} // Ends namespace Testing
  • 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-06-05T13:34:43+00:00Added an answer on June 5, 2026 at 1:34 pm

    AddressFilterMode.Prefix might suffice. The actual Endpoint used can be inspected in Service methods via
    OperationContext.Current.IncomingMessageHeaders.To

    Helper code can parse the endpoint and do any necessary internal processing from there.
    Hopefully there’s some extensibility on the server side which can simplify that code.

    Pseudocode for host:

    namespace Services
    {
        [System.ServiceModel.ServiceBehavior(AddressFilterMode =
             System.ServiceModel.AddressFilterMode.Prefix)]
        class BarService : Contracts.IBar
        {
            #region IBar Members
    
            public void DoSomething()
            {
                System.Uri endpoint = System.ServiceModel.OperationContext.Current.IncomingMessageHeaders.To;
                Console.WriteLine("DoSomething endpoint: {0}", endpoint);
            }
        } // Ends class BarService
    } // Ends namespace Services
    class RunHost
    {
        static void HostIBar()
        {
            System.Uri uriBase = new System.Uri("net.pipe://localhost");
            System.ServiceModel.ServiceHost hostBar =
                new System.ServiceModel.ServiceHost(
                typeof(Services.BarService),
                uriBase);
            hostBar.AddServiceEndpoint(
                  typeof(Contracts.IBar) // Type implementedContract
                , namedpipeBinding // System.ServiceModel.Channels.Binding binding
                , "root/IBar" //string address
            );
            hostBar.Open();
    
            Console.WriteLine("Press <ENTER> to stop...");
            Console.ReadLine();
        }
    }
    

    Correction: I’d originally said that this wouldn’t treat "net.pipe://localhost/root/IBar/1" and "net.pipe://localhost/root/IBar/2" as distinct endpoints, but it does. Each causes its own WCF Service instance to be created and called.

    An additional change was to encode the data in URL style query parameters and not embed it in the path. E.g.: "net.pipe://localhost/root/IBar?something=1&somethingelse=11" and "net.pipe://localhost/root/IBar?something=2&somethingelse=22" using HttpUtility.ParseQueryString

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

When programming, I need a way to have more than one clipboard (Vista). I
I need a way to programaticaly block and then later unblock specific websites based
My application has only one service class (not activity) in which I keep value
I wanted to create a one-way method for wcf service. Everything is ok unless
I need a way to distinguish development server in Django (run eg. by ./manage.py
I need a way to delete a line, im using this to write on
I need a way to cache searches on my node.js app. I had an
I need a way of accessing directly an instance of a class through an
I need a way to store application-level data (i.e. cross user sessions) in ASP.NET.
I need a way for a single variable to represent two kinds of objects

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.