沒有終結點在偵聽可以接受消息的 http://xx.com/WebService.svc。
這通常是由於不正確的地址或者 SOAP 操作導致的。如果存在此情況,請參見 InnerException 以了解詳細信息。
//-----------------------------------------------------------------------------------------------------------------------------------------------
public API.iClient xinghai = new API.iClient(Binding(), EndpointAddress()); public static System.ServiceModel.EndpointAddress EndpointAddress() { System.Configuration.ConfigurationManager.RefreshSection("appSettings"); return new System.ServiceModel.EndpointAddress(ConfigurationManager.AppSettings["Service_Address"]); } //創建WCF綁定連接實例 public static System.ServiceModel.BasicHttpBinding Binding() { System.ServiceModel.BasicHttpBinding bing = new System.ServiceModel.BasicHttpBinding(); bing.ReaderQuotas = new System.Xml.XmlDictionaryReaderQuotas() { //讀取 XML 數據時,超出最大字符串內容長度配額 (8192)。 MaxStringContentLength = int.MaxValue, MaxArrayLength = int.MaxValue }; //WCF:已超過傳入消息(65536)的最大消息大小配額。-則更改以下MaxReceivedMessageSize 屬性數字 bing.MaxReceivedMessageSize = int.MaxValue; return bing; }
調用的服務接口,時常夜間會報錯:這通常是由於不正確的地址或者 SOAP 操作導致的。如果存在此情況,請參見 InnerException 以了解詳細信息。
除了調用wcf封裝的類,動態讀取遠程接口外,域名的DNS解析可用性會直接影響到服務的連續,因此,最妥善的解決辦法,是嘗試接口地址用IP +端口的配置,進行遠程連接。
