>>09/07/11 10:48:46|dlewis5|342560768|An existing connection was forcibly closed by the remote host in System >>Stack trace: >> at System.Net.Sockets.Socket.Receive(Byte[] buffer, Int32 offset, Int32 size, SocketFlags socketFlags) >> at System.Net.Sockets.NetworkStream.Read(Byte[] buffer, Int32 offset, Int32 size) >>Call stack: >> at System.Net.Sockets.Socket.Receive(Byte[] buffer, Int32 offset, Int32 size, SocketFlags socketFlags) >> at System.Net.Sockets.NetworkStream.Read(Byte[] buffer, Int32 offset, Int32 size) >> >>>
private bool CreateWebServiceProxy() { if (ServiceDispatcher != null) return true; // Pretest for method safety if (ServerUris == null || ServerUris.Count < 1) return false; bool success = false; var binding = new BasicHttpBinding { MaxBufferSize = 20 * 1024 * 1024, MaxReceivedMessageSize = 20 * 1024 * 1024, ReaderQuotas = XmlDictionaryReaderQuotas.Max }; foreach (string uri in ServerUris) { binding.Security.Mode = uri.ToUpper().StartsWith("HTTPS:") ? BasicHttpSecurityMode.Transport : BasicHttpSecurityMode.None; _endpoint = new EndpointAddress(uri); var customBinding = new CustomBinding(binding); BindingElementCollection elements = customBinding.CreateBindingElements(); foreach (var element in elements.OfType<HttpTransportBindingElement>()) { (element).KeepAliveEnabled = false; } ServiceDispatcher = new WSDispatcherSEIClient(customBinding, _endpoint); Global.Log.Add(LoggingDebugLevel.Hint, string.Format("Communicator.Connect: trying to connect to '{0}'...", this._endpoint)); success = CheckService(); if (success) { _callWebServiceTotal = 0; Global.Log.Add(LoggingDebugLevel.Hint, string.Format("Communicator.Connect: connected to '{0}'", this._endpoint)); // Got a valid uri, so call it good and get out. break; } } return success; }