예제 #1
0
 /// <summary>
 /// Background CleanUp method
 /// </summary>
 private void CleanUpMethod()
 {
     using (_canceller.Token.Register(Thread.CurrentThread.Abort))
     {
         while (!_mustexit)
         {
             try
             {
                 int res = Certs.CleanOrphanedPrivateKeys();
                 if (res > 0)
                 {
                     _service.EventLog.WriteEntry(string.Format("{0} orphaned certificates private keys deleted.", res), EventLogEntryType.Error, 1010);
                 }
                 Thread.Sleep(new TimeSpan(0, 0, _minutes, 0));
             }
             catch (ThreadAbortException)
             {
                 _mustexit = true;
                 return;
             }
             catch (Exception ex)
             {
                 _service.EventLog.WriteEntry(string.Format("error on CleanUp Keys : {0}.", ex.Message), EventLogEntryType.Error, 1011);
             }
         }
     }
 }
예제 #2
0
 /// <summary>
 /// CleanOrphanedPrivateKeys method implmentation
 /// </summary>
 internal static int CleanOrphanedPrivateKeys()
 {
     EnsureService();
     try
     {
         return(Certs.CleanOrphanedPrivateKeys());
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }