Last post May 22, 2020 05:04 PM by shehz
May 12, 2020 09:01 PM|shehz|LINK
I have project setup dilemma. In fact I know it is not a good design but let me share what I have right now.
I was wondering if there is any easy way to switch between QA and production webservice without recompiling my code separately for both environments.
Currently in my project, I added two web references one for QA and one for Production. Both contain seperate URLs (right lick references>add reference>etc etc). it is an asmx file.
using System;using Reference1.qa;
//using Reference2.prod; UserUpdateSVC ws = new UserUpdateSVC();
As you can see, that I instantiate an object of a webservice class after I include the the reference at the top of the code.
Problem is that if I want to deploy to PROD environment, then I have to uncomment the production reference and comment out the qa reference because it points to a different URL and I have to recompile the application again because we are using Dlls to deploy
So basically for different environment, I have to switch the code and recompile it and generate separate dll. I know this is not right way of doing this but I'm using the reference to get method definition which is available for me to use.
Please advise with any code sample to give me an idea how I can avoid this redundant process and what alternative way I can instead apply.
May 12, 2020 09:45 PM|mgebhard|LINK
The service reference process adds a web.config entry for the URL. Just change the URL.
May 22, 2020 04:57 PM|shehz|LINK
Thanks for the reply. I didn't see any URL in the webconfig that points to the webservice, however I added below in webconfig to change its route but somehow it is not pointing to the desired URL. It is still pointing to the original websvc location not
to the temp locationbelow. Note, my app is in all the DLL and aspx.
<setting name="TempWebSVC" serializeAs="String">
May 22, 2020 05:04 PM|shehz|LINK
Never mind. I was calling an incorrect reference name! Thanks for the help