internal static void CloseConnectionGroups(string connectionGroupName) { // This method iterates through all service points and closes connection groups with the provided name. ServicePoint servicePoint = null; lock (s_ServicePointTable) { foreach (DictionaryEntry item in s_ServicePointTable) { WeakReference servicePointReference = item.Value as WeakReference; if (servicePointReference != null) { servicePoint = (ServicePoint)servicePointReference.Target; if (servicePoint != null) { // We found a service point. Ask the service point to close all internal connection groups // with name 'connectionGroupName'. servicePoint.CloseConnectionGroupInternal(connectionGroupName); } } } } }