public static class WSGateway { private static WSHttpBinding binding; private static EndpointAddress endpointAddress; static WSGateway() { var readerQuotas = new XmlDictionaryReaderQuotas() { MaxDepth = 6000000, MaxStringContentLength = 6000000, MaxArrayLength = 6000000, MaxBytesPerRead = 6000000, MaxNameTableCharCount = 6000000 }; binding = new WSHttpBinding(SecurityMode.None) {MaxReceivedMessageSize = 6000000, ReaderQuotas = readerQuotas}; endpointAddress = new EndpointAddress("http://machine:28666/DBInteractionGateway.svc"); } public static DBInteractionGatewayClient MR_WebService { get { return new DBInteractionGatewayClient(binding, endpointAddress); } } public static void ExecuteCommand(Action command) { var ws = MR_WebService; command.Invoke(ws); ws.Close(); } }