Can I change the URL of a web service link in a configuration file?

I have a .NET.NET oriented application. The solution uses the help folder of the VS web service. Grep through the solution shows that this URL is in multiple files. However, in a deployed application, a search shows that the URL only lives in .config. So what happened to .disco and .wsdl? Are they going to .exe? Basically, I need to update the URL, and I need to know if it needs a new assembly.

Thanks!

+7
web-services winforms asmx web-reference
source share
2 answers

Yes, you can change the URL referenced at runtime.

If it is in the .config file, IIS will be , your application should detect a change in the .config file and load the new value. If not, you will have to restart the client. Perhaps you can stop and start the website in IIS.

In addition, you can definitely WRITE your code to read from a .config file.

var myWS = new MyWebService(); myWS.Url = WebServiceURL; myWS.SomeMethod(); private static string WebServiceURL { get { return ConfigurationManager.AppSettings["MyWebServiceURL"].ToString(); } } 

Meanwhile, in your .config file, you have:

  <appSettings> <add key="MyWebServiceURL" value="http://blah/foo/bar.asmx" /> </appSettings> 
+4
source share

You can change the URL in the web configuration (if the web service remains the same. Not sure if the web service has changed)

0
source share

All Articles