private void StartThisService() { try { if (!EventLog.SourceExists(IStrEventLogSource)) { EventLog.CreateEventSource(IStrEventLogSource, IStrApplicationName); } UMPServiceLog.Source = IStrEventLogSource; UMPServiceLog.Log = IStrApplicationName; UMPServiceLog.ModifyOverflowPolicy(OverflowAction.OverwriteOlder, 3); WriteEntryLog("Service Started At : " + DateTime.Now.ToString("G"), EventLogEntryType.Information); IStrBaseDirectory = GetCurrentBaseDirectory(); WriteEntryLog("AppDomain.CurrentDomain.BaseDirectory :\n" + IStrBaseDirectory, EventLogEntryType.Information); //IStrPFCertificateFile = System.IO.Path.Combine(IStrBaseDirectory, "UMP.PF.Certificate.pfx"); //WriteEntryLog("Certificate File Name :\n" + IStrPFCertificateFile, EventLogEntryType.Information); IThreadCheckPFCertificate = new Thread(CheckPFCertificateIsExist); IThreadCheckPFCertificate.Start(); IThreadCheckServerCertificate = new Thread(CheckServiceCertificateIsExist); IThreadCheckServerCertificate.Start(); } catch (Exception ex) { WriteEntryLog("Start Service (Client Package) Exception:\n" + ex, EventLogEntryType.Error); } }
private void StartService07() { try { if (!EventLog.SourceExists(IStrEventLogSource)) { EventLog.CreateEventSource(IStrEventLogSource, IStrApplicationName); } UMPServiceLog.Source = IStrEventLogSource; UMPServiceLog.Log = IStrApplicationName; UMPServiceLog.ModifyOverflowPolicy(OverflowAction.OverwriteOlder, 3); IEventLog = UMPServiceLog; IStrSpliterChar = AscCodeToChr(27); IStrVerificationCode002 = CreateVerificationCode(EncryptionAndDecryption.UMPKeyAndIVType.M002); IStrVerificationCode102 = CreateVerificationCode(EncryptionAndDecryption.UMPKeyAndIVType.M102); WriteEntryLog("Service Started At : " + DateTime.Now.ToString("G"), EventLogEntryType.Information); IStrSiteBaseDirectory = GetSiteBaseDirectory(); IIntSiteHttpBindingPort = GetUMPPFBasicHttpPort(); IIntThisServicePort = IIntSiteHttpBindingPort - 7; IThreadReadDBProfile = new Thread(new ThreadStart(ReadDatabaseConnectionProfile)); IThreadReadDBProfile.Start(); IThreadSynchronousExtensionData = new Thread(new ThreadStart(SynchronousExtensionData)); IThreadSynchronousExtensionData.Start(); IThreadDeleteEncryptionData = new Thread(new ThreadStart(DeleteCompleteEncryptionData)); IThreadDeleteEncryptionData.Start(); } catch(Exception ex) { WriteEntryLog("StartService07()\n" + ex.ToString(), EventLogEntryType.Error); } }
private void StartService00() { if (!EventLog.SourceExists(IStrEventLogSource)) { EventLog.CreateEventSource(IStrEventLogSource, IStrApplicationName); } UMPServiceLog.Source = IStrEventLogSource; UMPServiceLog.Log = IStrApplicationName; UMPServiceLog.ModifyOverflowPolicy(OverflowAction.OverwriteOlder, 3); IEventLog = UMPServiceLog; WriteEntryLog("Service Started At : " + DateTime.Now.ToString("G"), EventLogEntryType.Information); IStrBaseDirectory = Common.GetCurrentBaseDirectory(); if (string.IsNullOrEmpty(IStrBaseDirectory)) { return; } IIntThisServicePort = 8009; if (!CreateCheckThreadIsAlive()) { return; } StartTcpSSLServer(IIntThisServicePort); WaitForSocketClientConnect(); }
/// <summary> /// 将日志写入 Windows 事情 /// </summary> /// <param name="AStrWriteBody">日志内容</param> /// <param name="AEntryType">日志类型</param> private void WriteEntryLog(string AStrWriteBody, EventLogEntryType AEntryType) { try { UMPServiceLog.WriteEntry(AStrWriteBody, AEntryType); } catch { } }