How to dynamically configure a webservice address?

J

John Dow

I have an ASP.Net project, in which I added a web reference, for example
http://Sandbox/service.asmx
after I pass the testing, I want to change the web service address to
http://Production/service/asmx, which has the exactly same interface as the
sandbox.

My question is how to dynamically configure the ASP.Net application point to
the right web service address after I deploy the code from test to
production enviroment without recompile the code?
Anyone can point me to the right direction how to solve this issue? Thanks
 
C

Chris Mullins [MVP - C#]

In the properties for the web service reference is a "Static | Dynamic"
option. I don't remember the actual property name, but as there are only a
half dozen properties, it's easy to find.

If you switch it to "Dynamic", it'll pull the URL out of the web.config
file. You can then have a different config file for production / dev / test
/ staging.
 
J

John Dow

Thanks, works like a charm!


Chris Mullins said:
In the properties for the web service reference is a "Static | Dynamic"
option. I don't remember the actual property name, but as there are only a
half dozen properties, it's easy to find.

If you switch it to "Dynamic", it'll pull the URL out of the web.config
file. You can then have a different config file for production / dev /
test / staging.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,994
Messages
2,570,223
Members
46,812
Latest member
GracielaWa

Latest Threads

Top