c# - dynamic binding of web service URI -


I have a list of servers, all highlight one web service interface, call me with my code the wanted.

i.e.

  https: //server1/service.asmx https: //server2/service.asmx https: //server3/service.asmx  < / Pre> 

My code needs to get this list of servers and apply the same function to all of them.

I have added a Web reference to the service, and I use behavior "dynamic" URL urge it to set the URI property at me server proxy create an instance of the object, runtime, and Web methods To call, right?

But it seems that the code generated by the VS URI considers the application's configuration file, which is not the case for this app.

  public SharpEyeWebService () {this.Url = global :: Company.DotNet.MyProject.Properties.Settings.Default .MyWebService; If ((This ISOLL file system web site (this. Url) == true)) {this.UseDefaultCredentials = true; This.useDefaultCredentialsSetExplicitly = false; } Else {this.useDefaultCredentialsSetExplicitly = true; }}  

Is it safe to ignore the URL that the constructor uses and employs the approach described above?

You can set always url , So yes it's safe "dynamic" affects you only default url : whether it's hard-coded or comes from config.

So in fact, it is important if you are supplying it to yourself.

Here's a bit strange that it UseDefaultCredentials to set on its base - so it will be able to manually set up so that you know the price.


Comments