Setting WCF Endpoint address at runtime?

Posted by james.ingham on Stack Overflow See other posts from Stack Overflow or by james.ingham
Published on 2010-04-23T00:08:41Z Indexed on 2010/04/23 0:13 UTC
Read the original article Hit count: 361

Filed under:
|
|

Hey,

If I have the following:

WSHttpBinding binding = new WSHttpBinding(); 
EndpointAddress endpoint = new EndpointAddress(new Uri("http://xxx:pppp/MyService")); 

MyServiceClient client = new MyServiceClient(binding, endpoint); 

How can I set the endpoint bindingConfiguration? If it helps my app.config is set to:

<endpoint address="http://xxx:pppp/Design_Time_Addresses/WcfServiceLibrary/ManagementService/"
          binding="wsHttpBinding" bindingConfiguration="WSHttpBinding_IManagementService"
          contract="ServiceReference.IManagementService">
        <identity>
              <dns value="localhost" />
        </identity>
</endpoint>

However I'm looking to let the user configure this before running the client.

Thanks

© Stack Overflow or respective owner

Related posts about c#

Related posts about wcf