Search code examples
vb.netweb-servicesurlvs-web-application-project

Deploy time Webservice location


In my Visual Studio Web application project I am adding a reference to a web service. When I add a web reference the following list of files gets generated.

  • Reference.map
  • Reference.vb
  • Reference.disco
  • Reference.wsdl

All these files contains the url pointing to the web service. Even when I move it to a machine without visual studio, it works fine. But if I intend to change the url of the web service, I need to modify all these four files by editing them using notepad.

Instead of this, is there any way I can have the url in the config file and just change it in one place and the web service are pointed to the new location.

I am using framework 1.1.


Solution

  • Set the web service reference "Url Behaviour" property to Dynamic, and the address will be cofigured in your app.config file....

    The app.config file should then contain something like

        <applicationSettings>
            <Exceptions.Properties.Settings>
                <setting name="Exceptions_CentreService_CentreService" serializeAs="String">
                    <value>http://localhost/CentreServiceCompatibility/CentreService.asmx</value>
                </setting>
            </Exceptions.Properties.Settings>
        </applicationSettings>