wsdl地址在哪配置?
1、添加一個App.config配置文件。2、配置服務(wù)
http://Lenovo-PC:80/EvisaWS/WharfService?wsdl
,那么在上面的文件中就會自動生成服務(wù)的配置:復(fù)制代碼代碼如下:<?xml version="1.0" encoding="utf-8" ?><configuration> <system.serviceModel> <bindings> <basicHttpBinding> <binding name="WharfWSBeanBinding" /> </basicHttpBinding> </bindings> <client> <endpoint address="http://Lenovo-PC:80/EvisaWS/WharfService
" binding="basicHttpBinding" bindingConfiguration="WharfWSBeanBinding" contract="WharfService.WharfWSBean" name="WharfService" /> </client> </system.serviceModel></configuration>3、動態(tài)添加新的地址,后面的?wsdl沒有也可以:復(fù)制代碼代碼如下:WharfWSBeanClient c = new WharfWSBeanClient("WharfService", "新的地址例如:http://192.168.1.194/EvisaWS/WharfService?wsdl
");4、新服務(wù)器的地址可以存放到注冊表或者環(huán)境變量里面,下面是新存放到注冊表,然后再存放到環(huán)境變量里,訪問的時候先從環(huán)境變量里面獲?。?.1 存到注冊表:復(fù)制代碼代碼如下:RegistryKey key = Registry.LocalMachine.CreateSubKey(@"Software\Client");key.SetValue("ip", "192.168.1.1");4.2 從注冊表獲取值:復(fù)制代碼代碼如下:String ip =Environment.GetEnvironmentVariable("myconfigip");if (ip == null || ip.Equals("")){RegistryKey key = Registry.LocalMachine.OpenSubKey(@"Software\Client");ip = key.GetValue("myip") as string;Environment.SetEnvironmentVariable("myconfigip", ip);}上面是先從環(huán)境變量里面取,如果沒有則從注冊表取,之后又存放到環(huán)境變量里,以后在進(jìn)程內(nèi)訪問時直接從環(huán)境變量里面取就可以了。