2

I am creating a WCF service and Client application. I want to use the service in the client application.

The location where the WCF service will be hosted is not yet finalized. I want to dynamically add the reference of the hosted WCF service without building the client application. How can I achive this?

Thanks,

Ram

Ram
  • 11,404
  • 15
  • 62
  • 93
  • 1
    i can;t get it. without building the app??? you can change the web.config file to change the endpoint address any time but it isn't dynamic.. can you further clarify what kind of client it is web, desktop? – Shoaib Shaikh Jan 06 '11 at 06:39

1 Answers1

5

Do this:

  • create the client as you would in any normal case
  • change the service URL in the config when the service "moves" around

I think this would be by far the easiest solution.

If you insist on a dynamic proxy - there's a sample of a WCF dynamic proxy here:

http://code.msdn.microsoft.com/netfxsamples/Wiki/Print.aspx?title=WCF%20samples&version=8&action=Print

Scroll down a bit to find the sample. It was C# code to show you how to dynamically create a WCF proxy all in code.

marc_s
  • 732,580
  • 175
  • 1,330
  • 1,459