You have a couple options. In the properties of your WebReference, you can
set the UrlBehavior property to Dynamic. This will create an entry in the
web.config file for your web service that you can edit.
A better way IMO is to leave the WebReference UrlBehavior set to Static but
after you instantiate the proxy in your application you can simply set the
Url property to whatever you want. In the environment where I work, we do
this to configure for local, development, test, or production environments.
In web.config, add an entry:
<add key="WSUrl-Production"
value="http://mywebserver/mywebserviceapp/my.asmx">
Then, in code we get the url for the environment we're in:
MyWebService.Proxy proxy = new MyWebService.Proxy();
proxy.Url = System.Configuration.ConfigurationSettings.AppSett ings["WSUrl-"
+ currentEnvironment];
While I do it in we.config in my environment, you could do it in app.config
the same way for WinForms.
That's all there is to it.
HTH
--
Dale Preston
MCAD C#
MCSE, MCDBA
"Chad" wrote:
I created my first simple web service on my local PC> I tested it using the
test page that is generated for you. I then created a standalone app, and
in the IDE, set a reference to the local web service. I was able to call it
successfully.
The next step, I want to move it to a remote server and try to call that. I
expect that that shoudl work.
What I do not know how to do is this:
I would like to make the URL of the location of the web service
dynamic/parameterized or read from a file, so when I release the web app
consumer program, I can change the consumer to point to either the
production or development web service.
Many thanks for any feedback