KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
The following is my Windows service code. When I am debugging the code, I am getting the error/ exception: The type initializer for 'CSMessageUtility.CSDetails' threw an exception. using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Diagnostics; using System.Linq; using System.ServiceProcess; using System.Text; using System.IO; using System.Threading; using System.Windows; using System.Windows.Forms; using CSMessageUtility; namespace CS_Data_Trasmmiting_Service { public partial class svcCSWinServ : ServiceBase { //private string sLogFormat; //private string sErrorTime; private Thread new_thread; Logger logObject = new Logger(); private bool isenable = true; public svcCSWinServ() { InitializeComponent(); logObject.append("Initialize Service " + DateTime.Now.ToString(), 70); CheckForAlarms(); } protected override void OnStart(string[] args) { try { new_thread = new Thread(new ThreadStart(CheckForAlarms)); new_thread.Start(); } catch { } logObject.append("Service Started successfully " + DateTime.Now.ToString(), 70); } protected override void OnStop() { try { isenable = false; new_thread.Abort(); } catch { } logObject.append("Service Stopped successfully " + DateTime.Now.ToString(), 70); } void CheckForAlarms() { try { while (true) { //if((DateTime.Now.ToString("HH:mm") == "18:00")) //{ logObject.append("Start Sending Data " +DateTime.
Tags (comma-separated)
Save Edits
Cancel