I have a single WCF service but, until runtime, I don't know the correct address of the service. It may be :
http://example1.com/MyService.svc
// or
http://example2.com/MyService.svc
The service is used by a class library (DAL). I have two options:
- Add a service reference to the service (Visula Studio 2010) and change the address at run-time. This way VS-2010 will create WSDL and other stuff for me (I'm not sure if this is even possible).
- Create the proxy on the fly and set the base service address. This needs more work and if I make any change to service, I need to generate WSDL myself. Maintenance of this code is not as easy as option one.
Which option to use? Also if option two is recommended by you, then should I my client wrapper class be singleton or I can create all the connection stuff on each call?