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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T15:19:47+00:00 2026-06-04T15:19:47+00:00

I’ve got a modular application that instantiates things in separate AppDomains and communicates with

  • 0

I’ve got a modular application that instantiates things in separate AppDomains and communicates with them over WCF pipes. I don’t want anyone outside of my process to be able to connect to these pipes.

Suggestions?

<edit>I don’t know much about remoting — would it be a terrible idea to write a transport that uses remoting under the hood?</edit>

  • 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-04T15:19:49+00:00Added an answer on June 4, 2026 at 3:19 pm

    Sorry, I might be late… but better late than never 🙂
    What you could do is sharing an object between your AppDomains…
    For example create a random GUID in the first one and send it to the second one (serialization…).
    then, if both AppDomains know this auth token, you may do something like this :

    /// <summary>
    /// Inspect client messages : add GUID in headers
    /// </summary>
    internal class CProcessAuthenticationClientInspector : IClientMessageInspector
    {
    
        #region IClientMessageInspector Membres
    
        public void AfterReceiveReply(ref System.ServiceModel.Channels.Message reply, object correlationState)
        {
        }
    
        public object BeforeSendRequest(ref System.ServiceModel.Channels.Message request, System.ServiceModel.IClientChannel channel)
        {
            request.Headers.Add(MessageHeader.CreateHeader("ProcessAuth", "http://schemas.YOURCOMPANY.com/YOURAPPID", CProcessAuthenticationBehavior._authToken));
            return null;
        }
    
        #endregion
    }
    
    /// <summary>
    /// Inspect server messages : Check GUID
    /// </summary>
    internal class CProcessAuthenticationDispatchInspector : IDispatchMessageInspector
    {
    
        #region IDispatchMessageInspector Membres
    
        public object AfterReceiveRequest(ref Message request, System.ServiceModel.IClientChannel channel, System.ServiceModel.InstanceContext instanceContext)
        {
            Guid token = OperationContext.Current.IncomingMessageHeaders.GetHeader<Guid>("ProcessAuth", "http://schemas.YOURCOMPANY.com/YOURAPPID");
            if (token != CProcessAuthenticationBehavior._authToken)
                throw new Exception("Invalid process");
            return null;
        }
    
        public void BeforeSendReply(ref Message reply, object correlationState)
        {
    
        }
    
        #endregion
    }
    
    /// <summary>
    /// Add inspectors on both client and server messages
    /// </summary>
    public class CProcessAuthenticationBehavior : IEndpointBehavior
    {
        /// <summary>
        /// Authentification token known by both sides of the pipe
        /// </summary>
        internal static Guid _authToken = Guid.NewGuid();
    
        #region IEndpointBehavior Membres
    
        public void AddBindingParameters(ServiceEndpoint endpoint, System.ServiceModel.Channels.BindingParameterCollection bindingParameters)
        {
        }
    
        public void ApplyClientBehavior(ServiceEndpoint endpoint, System.ServiceModel.Dispatcher.ClientRuntime clientRuntime)
        {
            clientRuntime.MessageInspectors.Add(new CProcessAuthenticationClientInspector());
        }
    
        public void ApplyDispatchBehavior(ServiceEndpoint endpoint, System.ServiceModel.Dispatcher.EndpointDispatcher endpointDispatcher)
        {
            endpointDispatcher.DispatchRuntime.MessageInspectors.Add(new CProcessAuthenticationDispatchInspector());
        }
    
        public void Validate(ServiceEndpoint endpoint)
        {
        }
    
        #endregion
    }
    

    And then you just need to add your endpoint behaviour to your endpoint on both sides :

    client :

    ChannelFactory<TInterface> factory;
    factory = new ChannelFactory<TInterface>(BuildLocalBinding(), "net.pipe://localhost/foo");
    factory.Endpoint.Behaviors.Add(new CProcessAuthenticationBehavior());
    

    server :

    ServiceHost svcHost = new System.ServiceModel.ServiceHost(imlpementationType);
    svcHost.AddServiceEndpoint(interfaceType, binding, "net.pipe://localhost/foo");
    svcHost.Description.Endpoints[0].Behaviors.Add(new CProcessAuthenticationBehavior());
    

    Well… this may be done in config, but I’ll let you dig 🙂

    Hope this helps.

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

Sidebar

Related Questions

I've got a string that has curly quotes in it. I'd like to replace
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
link Im having trouble converting the html entites into html characters, (&# 8217;) i
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I have a French site that I want to parse, but am running into
I am doing a simple coin flipping experiment for class that involves flipping a
i got an object with contents of html markup in it, for example: string
I need a function that will clean a strings' special characters. I do NOT
I'm trying to create an if statement in PHP that prevents a single post

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.