Archive for March, 2009

Dynamic URL for web services

March 20, 2009 Leave a comment

Today one of my colleague asked a simple question: How to change the URL of a web service dynamically?

He was using visual studio 2005. And he was using the web service directly from web site.

The answer to his question is as simple as the question itself.

Just add a web reference to the web site and after successful addition of the web service to the web site, a key is created for this web service in the web site’s web.config file under AppSettings tag. The name of the key will be defaulted to the name you gave during addition of this web reference.

So when you move this web site through all the stages to production, it will be enough to just change the URL in this web.config during installation.

<add key=”localhost.Service1″ value=”http://localhost:29745/Service1.asmx”/&gt;

This is the same for visual studio 2008 too.

Hello world!

March 20, 2009 1 comment

Welcome to This is your first post. Edit or delete it and start blogging!

Categories: Uncategorized