Question: I have inherited a .NET 4 VS2010 solution consisting of a WinForms app and a web service. I don't have access to a server that's running a copy of the web service but I have to run, debug, upgrade and test the project that accesses the web service as well as the web service code.

Later, I also want to quickly switch between a deployed web service and the code in my local project

What's the best strategy for changing the projects so I can make changes to both projects, test locally, deploy the web service then test against that? If I find issues, I want to switch back to "local" mode to debug.

Thanks team!

Answer: 
The easiest is to host the service locally in visual studio and change the service url to switch between the production service and the local one. You can automatically switch between the services by checking for Debug and Release modes using `#if` and `#else` directives.

You can also use the interface to provide a stub of the service. This will also make unit testing easier.
* Host your web service in IIS or using a local development web server (cassini)
* Use *app.config* to store the address of the web server
* Get the code to use the build the endpoint of the web service based on the app.config
* Change web server address in the web.config to switch between servers.