Creating Dymanic Web Service References in Visual Studio .NET 2003

Found the following samples that help you create a web service in a .NET project that is Dynamic. I got tired of having to create versions of my project every time we changed the web service URL. Especially as we moved from Dev, Test, Prod. The binaries were getting confusing.

Dynamically Change Webservice URL

  1. register a webservice ( I then changed the folder to the default name of the web service i wanted)
  2. right click the webservice change URL Behavior to Dynamic
  3. click the 'show all files' icon in solution explorer
  4. in the web reference edit the Reference.cs file
  5. change class constructor such that you add the parts in bold. Note some comments are in bold.)

public wsMLA(string urlSetting) {
// string urlSetting = System.Configuration.ConfigurationSettings.AppSettings[""];
if ((urlSetting != null)) {
this.Url = string.Concat(urlSetting, "");
else {
this.Url = "";

Then you can set the URL when you instantiate the class.

Thanks goes to the folks at

Comments (0) Trackbacks (0)

No comments yet.

Leave a comment


No trackbacks yet.