Change Web service URL in web config at run time

Hi… all…

I am consuming AX web service in external application with a window application. It is workinng fine. But my service will be running on more then more servers and user can select which server he wants to use. So if he chooses any server i have to change the service reference at runtime. And IP address of all the servers are dynamic. So what i want to do that, when the IP address of any server changes, then its reference shud be automatically changed in the application and if user changes his server then service reference of new server should be added…

I have searched a lot but nothing worked…

can anybody help me out… Its very urgent…

Any suggession…?


You can set the EndpointAddress in ServiceClient contructor, or later through the Endpoint property.

Hello Martin,

Thank you for you reply,the thing is in the end point address i have to change the url at run time ,i mean it should automatically detect the server name and the full address where the svc file is going to get stored.

And i am not knowing the concept of endpoint at all.So please can you elaborate answer so that i can understand that .

And i am not getting the way of doing that .

Please help me if you can.

Unfortunately, I have no idea how you want to automatically detect the server name etc., so I can’t provide any advice.

About endpoints, you can find many on-line resources - the best way is to begin with Endpoints: Addresses, Bindings, and Contracts on MSDN.