I have a small sharepoint project which integrates into a larger sharepoint project. My project uses two web services. I’ve added them using Web Reference (embedded in the Service Reference) dialog in VS2010. We have two sets of web services – one for testing and one for production. When I deploy the app locally, the web services settings are written to the web.config file located at C:\inetpub\wwwroot\wss\VirtualDirectories\80\ on my local machine. The section looks something like this –
<applicationSettings>
<XXX.YYY.Properties.Settings>
<setting name="XXX_YYY_ZZZ_WS1" serializeAs="String">
<value>http://<TEST_IPAddress>/WebService/WS1.asmx</value>
</setting>
<setting name="XXX_YYY_ZZZ_WS2" serializeAs="String">
<value>http://<TEST_IPAddress>/WebService/WS2.asmx</value>
</setting>
</XXX.YYY.Properties.Settings>
</applicationSettings>
The difference between the test and production web services is just the IP Address. When I change the IP address to production, the app is not using the new values. I had to go back to VS, update the Web Reference URL in the Properties dialog to the correct production urls, then re-deploy the package again. This is tedious as I constantly keep switching from test to production web service url’s. I want to be able to change the IP address in the app.config, refresh the page in the browser and it should pick up the new urls.
Am I doing something wrong? Is there another way to do this?
I think if you change the webservice url in code then you will not have to repeat the build process. you can change like this