1
當我做到這一點,在這樣的在運行時更改服務的地址
<client>
<endpoint address="http://192.168.1.7/zfsapi/api.php" binding="basicHttpBinding"
bindingConfiguration="ZfsSoapBinding" contract="SourceAPI.ZfsSoapPort"
name="ZfsSoapPort" />
</client>
而且我在運行時這樣
EndpointAddress epa1 = new EndpointAddress("http://192.168.1.7/zfsapi/api.php");
DemoChangingAddressApi.SourceAPI.ZfsSoapPortClient oservice = new SourceAPI.ZfsSoapPortClient(binding1, epa1);
DemoChangingAddressApi.SourceAPI.ZfsVolume[] v1 = oservice.getVolumeList();
// or instantiate whatever other binding you're using
BasicHttpBinding binding = new BasicHttpBinding();
// define the endpoint address
EndpointAddress epa = new EndpointAddress("http://192.168.1.8/zfsapi/api.php");
// create your WCF client-side proxy based on those settings
DemoChangingAddressApi.SourceAPI.ZfsSoapPortClient oservice1 = new SourceAPI.ZfsSoapPortClient(binding, epa);
DemoChangingAddressApi.SourceAPI.ZfsVolume[] v2 = oservice1.getVolumeList();
chnages我的地址的客戶端,我的Web配置我得到錯誤@DemoChangingAddressApi.SourceAPI.ZfsVolume[] v2 = oservice1.getVolumeList();
錯誤:
反序列化操作'getVolumeList'的消息體 錯誤。
我怎麼可以,如果你訪問的web.config文件的XML,你總是能夠在運行時在提供服務
如果第一次調用(v1)工作,第二次調用不成功,則問題出現在第二臺服務器上。配置不同或者服務的操作不提供相同的結果,並且客戶端無法反序列化響應。 – 2011-03-11 20:30:43