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

  • Home
  • SEARCH
  • 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 6032725
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T05:22:34+00:00 2026-05-23T05:22:34+00:00

I have a WCF proxy generated at runtime with DuplexChannelFactory. How can I access

  • 0

I have a WCF proxy generated at runtime with DuplexChannelFactory.

How can I access the binding information given only the service interface returned from DuplexChannelFactory?

I can get most stuff by casting to an IClientChannel, but I can’t seem to find binding info on there. The closest I can get is IClientChannel.RemoteAddress which is an endpoint, but that doesn’t seem to have binding info either. :-/

  • 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-23T05:22:35+00:00Added an answer on May 23, 2026 at 5:22 am

    You can’t (directly). There are a few things which you can get from the channel, such as the message version (channel.GetProperty<MessageVersion>()), and other values. But the binding isn’t one of those. The channel is created after the binding is “deconstructed” (i.e., expanded into its binding elements, while each binding element can add one more piece to the channel stack.

    If you want to have the binding information in the proxy channel, however, you can add it yourself, using one of the extension properties of the context channel. The code below shows one example of that.

    public class StackOverflow_6332575
    {
        [ServiceContract]
        public interface ITest
        {
            [OperationContract]
            int Add(int x, int y);
        }
        public class Service : ITest
        {
            public int Add(int x, int y)
            {
                return x + y;
            }
        }
        static Binding GetBinding()
        {
            BasicHttpBinding result = new BasicHttpBinding();
            return result;
        }
        class MyExtension : IExtension<IContextChannel>
        {
            public void Attach(IContextChannel owner)
            {
            }
    
            public void Detach(IContextChannel owner)
            {
            }
    
            public Binding Binding { get; set; }
        }
        static void CallProxy(ITest proxy)
        {
            Console.WriteLine(proxy.Add(3, 5));
            MyExtension extension = ((IClientChannel)proxy).Extensions.Find<MyExtension>();
            if (extension != null)
            {
                Console.WriteLine("Binding: {0}", extension.Binding);
            }
        }
        public static void Test()
        {
            string baseAddress = "http://" + Environment.MachineName + ":8000/Service";
            ServiceHost host = new ServiceHost(typeof(Service), new Uri(baseAddress));
            host.AddServiceEndpoint(typeof(ITest), GetBinding(), "");
            host.Open();
            Console.WriteLine("Host opened");
    
            ChannelFactory<ITest> factory = new ChannelFactory<ITest>(GetBinding(), new EndpointAddress(baseAddress));
            ITest proxy = factory.CreateChannel();
    
            ((IClientChannel)proxy).Extensions.Add(new MyExtension { Binding = factory.Endpoint.Binding });
    
            CallProxy(proxy);
    
            ((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'm new here and I hope anyonte can help me. I have WCF Service
I have a single WCF service but, until runtime, I don't know the correct
I have a .Net WCF client/proxy built based on a Delphi service. The Delphi
I have a WCF client generated with Add Service Reference, problem is that the
I have a transparent proxy, for instance one generated by WCF: ChannelFactory<ICalculator> channelFactory =
I have WCF endpoint exposed as defined bellow, <service name=MyApp.Server.Endpoint.Orange behaviorConfiguration=MyTio.Server.Endpoint.OrangeBehavior> <endpoint address= binding=basicHttpBinding
I have a WCF service that I have to reference from a .net 2.0
I have a wcf application hosted in a windows service running a local windows
I have a WCF Web Service which is referenced from a class library. After
I have a WCF service hosted for internal clients - we have control of

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.