[Solved] how to modify this single thread into multithreading in c# .net [closed]

[ad_1] This appears to already be multi-threaded. Try adding logging code to the start and end of each FileGenerationForXXX method so you can see the four methods starting together and stopping separately. private void FileGenerationForITD() { eventlog1.WriteEntry(“FileGenerationForITD started.”); … eventlog1.WriteEntry(“FileGenerationForITD finished.”); } Additionally, you can knock out all of the if statements. The thread objects … Read more

[Solved] Multithreaded Windows Service

[ad_1] Yes it’s perfectly possible to create a multi-threaded windows service. Just spawn a new thread when you receive a message via your preferred way of handling things. This is the manual way, you could also use a background worker: Thread t = new Thread(() => { // Do some work }); There’s nothing preventing … Read more

[Solved] Bad timer in Windows service

[ad_1] You have most likely an error somewhere in your timer making it throw an exception. You will not detect that since System.Timers.Timer silently ignores all unhandled exceptions. You’ll therefore have to wrap all code with a try/catch block: private void getFileList(object sender, EventArgs e) { try { DeleteOldBackupFiles(); } catch (Exception ex) { //log … Read more

[Solved] how to use windows service in windows form application [closed]

[ad_1] You can use Timer to periodically update the database Timer timer = new Timer(); timer.Tick += new EventHandler(timer_Tick); // Everytime timer ticks, timer_Tick will be called timer.Interval = (10) * (1); // Timer will tick evert 10 seconds timer.Enabled = true; // Enable the timer timer.Start(); void timer_Tick(object sender, EventArgs e) { //Put your … Read more

[Solved] WMI lib to start windows service remotely

[ad_1] There is documentation regarding the library on github: https://github.com/tjguk/wmi/blob/master/docs/cookbook.rst I believe the above code is throwing an error because you are not specifying which service to start. Assuming you don’t know what services are available to you: import wmi c = wmi.WMI() # Pass connection credentials if needed # Below will output all possible … Read more