//create wcf proxy object private ServerClient GetClient() { try { var client = new ServerClient(); client.ClientCredentials.UserName.UserName = "******".GetRegString(); client.ClientCredentials.UserName.Password = "******".GetRegString(); return(client); } catch (NullReferenceException ex) { (ex.Message + ex.InnerException).WriteLog(EventLogEntryType.Error, 303); return(null); } catch (Exception ex) { (ex.Message + ex.InnerException).WriteLog(EventLogEntryType.Error, 303); _client.Abort(); return(null); } }