Configure WCF Remote Persistence without EndpointConfigurationName?

CapableObjects Forums SupportForum Configure WCF Remote Persistence without EndpointConfigurationName?

This topic contains 5 replies, has 2 voices, and was last updated by  efim 3 months, 1 week ago.

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
  • #4316



    I have requirement to tune some WCF-Binding parameter at run time, before Remote Persistence is first time used. As I see the PersistenceMapperWcfClient.EndpointConfigurationName is currently the only way to get fully customized WCF communication with RP Server.
    For my requirement I Need to set it in another way e.g. Binding and EndpointAddress.

    Is it somehow possible in the current Version?

    Background for requirement: Using ClickOnce it is not possible to change Client configuration Settings, because of that I need a way to do it at run time.




    If you define your different types of bindings in config with different endpoint names you can choose between the endpoints with:
    persistenceMapperWCFClient.EndpointConfigurationName = xxxx;
    and you can set the Uri:
    persistenceMapperWCFClient.Uri = yyyy;

    To provide user and pwd in runtime (whenever your link goes down and reconnect):

    persistenceMapperWCFClient.WCFFactoryCreated += new EventHandler(persistenceMapperWCFClient_WCFFactoryCreated);

    void persistenceMapperWCFClient_WCFFactoryCreated(object sender, Eco.Wcf.Client.WCFFactoryCreatedArgs e)
    e.Factory.Credentials.UserName.UserName =uuu;
    e.Factory.Credentials.UserName.Password = ppp;

    You can build the bindings from code as well – but that is not a specific MDriven question but a standard WCF question

    • This reply was modified 3 months, 1 week ago by  Admin.


    Hi Hans,

    I can reformulate my question:

    suppose I have a configured Binding instance stored in a variable:

    Binding b= new Binding();
    …. Some configurations…

    and an assigned EndpointAddress.

    How can I use these to configure PersistenceMapperWcfClient instead of EndpointConfigurationName?

    Perhaps over WCFFactoryCreated or another event?




    If you leave EndpointConfigurationName empty we will trigger the WCFProvideBinding event:

            public event EventHandler<WCFProvideBindingArgs> WCFProvideBinding;
      public class WCFProvideBindingArgs : EventArgs
        public System.ServiceModel.Channels.Binding BindingToUse;
    And you would then do something like this:
                      WSHttpBinding bbinding = new WSHttpBinding();
                      bbinding.MaxReceivedMessageSize = MaxReceivedMessageSize;
                      bbinding.ReaderQuotas = System.Xml.XmlDictionaryReaderQuotas.Max;
                      bbinding.MaxBufferPoolSize = 0;
                        bbinding.Security.Mode = SecurityMode.TransportWithMessageCredential;
                        bbinding.Security.Message.ClientCredentialType = MessageCredentialType.UserName;
                      bbinding.Security.Transport.ClientCredentialType = this.ClientCredentialType;
                      binding = bbinding;


    That’s exactly what I need. One small question: can I set EndpointConfigurationName in this event handle, i.e. would it be used? I need it as alternative way if binding cannot be retrieved.



    I tested it, and my result is No, it’s not possible. So I should set EndpointConfigurationName before WCFProvideBinding is fired. In my scenario it led to a bit overhead, but it is solved now anyway

Viewing 6 posts - 1 through 6 (of 6 total)

You must be logged in to reply to this topic.

Comments are closed.