2011-03-31 61 views

回答

3

您是否創建自己的綁定和端點地址,然後使用這些地址使客戶端成爲一個固定的?一個簡單的例子(包括超時選項):

BasicHttpBinding binding = new BasicHttpBinding(); 
binding.OpenTimeout = new TimeSpan(0, 0, 10); 
binding.CloseTimeout = new TimeSpan(0, 0, 10); 
binding.SendTimeout = new TimeSpan(0, 0, 30); 
// more attributes for the binding 

EndpointAddress endpointAddress = new EndpointAddress("https://mywcfserver.com/WCFService.svc"); 
ClientProxy client = new ClientProxy(binding, endpointAddress); 

只是要注意,你在代碼中定義的綁定,應該是一樣的約束力definited Web服務的app.config中。