i have created wcf service and client. both wcf service and client are implemented using c#. i have hosted this wcf service in both iis and windows service. while i am hosting it, i need to specify the base address either in web.config file or in design time. is it possible to specify base address at run time. how to provide it at run time?
like this can i change the service reference address at client side. how to do it in c# ?
If you're using self-hosting, then you can specify the base address in the constructor of the
ServiceHost
class:With IIS, things get a bit trickier.... you might be able to provide a custom factory to create your service host - but that seems like a whole lot of work. In addition, with IIS, the virtual directory where your
*.svc
file exists really dictates the URL of your service - so providing a base address really isn't of much value.