Get Help:Ask a Question in our Forums|Report a Bug|More Help Resources
Last post Nov 14, 2012 09:19 AM by Mad-Halfling
Nov 07, 2012 03:25 PM|LINK
Hi, I have a web service reference that I am accessing and consuming successfully in my test environment, however I have an issue when moving to live as there are two versions of this service, one for live and one for test.
Apparently if, when I hit [Add Service Reference] and then select [Advanced] and add the reference in via there it should put the URL in the .config files, and it appears to do this, however when I deploy the application I can find the URL string in the
compiled .DLL file as well as the config files, so I'm very unsure/unhappy about this. Obviously I can change it in the source code when I deploy to test and live, but this is (for the obvious reasons) a terrible idea as not only do I have to remember to
do this, but also other people working on the system in future will have to both know about and remember to do this, too. I handle this for all my other references by having web.config files specifically for the test and live environments that aren't overwritten
and this is the standard for all our apps and so isn't an issue with regard to being overwritten by other developers. Is there a way to consume a web service and have its URL purely configured in the .config files?
Cheers - MH
Nov 09, 2012 03:29 PM|LINK
What i feel is that you should keep these references in the database.becuase if you keep in web.config you app will reset again.
so it is better you keep in table.
in table you can create two column
for the type and next for reference
and whenver changes happens you can refer from the table and in this case yor app will also not reset again.
Nov 09, 2012 04:37 PM|LINK
OK, that's a fair point, but either way, how do I get that into the Web Service reference - you have to put the URL in when you add the service reference to the project, and it get's compiled into the DLL, so whether I get it from the database or the web.config,
don't I still have the same problem, or am I missing something?
Nov 14, 2012 03:26 AM|LINK
first time when you create a reference you need to set.
but at run time you can again set the reference.
you can again pass reference which you read from the database.
Nov 14, 2012 09:19 AM|LINK
Yes, I know that's the theory, but my concern is that if I grep my whole application for the connection string, it comes up as being both in the config file and also in the compiled DLL file in \bin - so it's extremely concerning that it might pick up the