2
我有一个服务器列表,所有服务器公开了相同的Web服务接口,我需要从我的代码调用。Web服务URI的动态绑定
即
https://server1/service.asmx
https://server2/service.asmx
https://server3/service.asmx
我的代码需要得到服务器的列表和调用上所有的人相同的功能。
我添加了对此服务的Web引用,并使用“动态”URL行为。这应该让我创建一个服务器代理对象的实例,在运行时设置URI属性,然后调用Web方法,对吧?
但似乎由VS生成的代码假定URI将来自应用程序的配置文件,而不是这个应用程序的情况。
public SharpEyeWebService() {
this.Url = global::Company.DotNet.MyProject.Properties.Settings.Default.MyWebService;
if ((this.IsLocalFileSystemWebService(this.Url) == true)) {
this.UseDefaultCredentials = true;
this.useDefaultCredentialsSetExplicitly = false;
}
else {
this.useDefaultCredentialsSetExplicitly = true;
}
}
它是安全的忽略默认URL构造用途和使用我上面介绍的方法呢?
相同的凭据配置似乎设置在URL的属性设置器中,所以我认为没关系。 – 2010-07-18 10:32:41