We help IT Professionals succeed at work.

asp.net webservice redirect

dhenderson12 used Ask the Experts™
I have a website that includes a webservice that a client application uses for database transactions.  We are changing the "design" such that many copies of the website will be available through subnets, and a copy of the database will be available for each copy of the website.

My question is how to do the same for the webservice.  Is there a way to set the reference to the webservice client at runtime to use the correct webservice based on the url of the specific website that hosts the service?
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Senior Software Engineer
Top Expert 2009
In principle, you need to change:
The address configuration file of each web service to the current location, so that every web service has a unique address.
Import the web service to your website or modify your website config file to point to the new web service location (This step depends on how your website consumes the web service)

For example, in the link below you need to change the base address to a unique url location, so that the other web services do not collide with this.

Alternative(Beyond question scope anyway): If you are trying to build a web farm because your current website cannot handle traffic.You need to treat your web service as an independent application, so that one web service will interact with multiple copies of your website. Thus, you host only one web service in IIS - if your concern is that your web service can not cope with traffic, you can try web gardens but I will strongly suggest you review the perfomance and scalability of your appliation.