/// <summary> /// netsh http delete urlacl http://*:8888/ /// </summary> public void ReleaseLocalPort(int?port, string userName) { if (String.IsNullOrWhiteSpace(userName)) { throw new ArgumentNullException("userName"); } log.Info("Releasing port {0} for user {1}", port, userName); if (port.HasValue) { if (!netShRunner.DeleteRule(port.Value)) { throw new Exception(String.Format("Error removing reservation for port '{0}'", port)); } } try { firewallManager.ClosePort(userName); } catch (Exception ex) { throw new Exception(String.Format("Error removing firewall rule for port '{0}', user '{1}'", port, userName), ex); } }
/// <summary> /// netsh http delete urlacl http://*:8888/ /// </summary> public void ReleaseLocalPort(int? port, string userName) { if (String.IsNullOrWhiteSpace(userName)) { throw new ArgumentNullException("userName"); } log.Info("Releasing port {0} for user {1}", port, userName); if (port.HasValue) { netShRunner.DeleteRule(port.Value); } firewallManager.ClosePort(userName); }