Why won’t my windows service write to my log file?

I’ve had this issue too. As mentioned by genki you are probably logging into the \Windows\System32 directory. Maybe check for the log file you are expecting there first. When writing services I’ve often put a line like this in the beginning to get the current directory to behave like a normal application Directory.SetCurrentDirectory(AppDomain.CurrentDomain.BaseDirectory);

Windows service with timer

First approach with Windows Service is not easy.. A long time ago, I wrote a C# service. This is the logic of the Service class (tested, works fine): namespace MyServiceApp { public class MyService : ServiceBase { private System.Timers.Timer timer; protected override void OnStart(string[] args) { this.timer = new System.Timers.Timer(30000D); // 30000 milliseconds = 30 … Read more

running Elastic Search as a Windows service

As of 0.90.5+, support for running ElasticSearch as a Windows Service is officially included in the Windows distribution. https://www.elastic.co/blog/0-90-5-released/ From the bin folder: > service.bat Usage: service.bat install|remove|start|stop|manager [SERVICE_ID] > service install Installing service : ‘elasticsearch-service-x64’ Using JAVA_HOME (64-bit): c:jvmjdk1.7 The service ‘elasticsearch-service-x64’ has been installed. > service start The service ‘elasticsearch-service-x64’ has been started … Read more

Visual Studio refuses to build project due to missing assembly reference that isn’t missing

In my case, target Framework of Assembly Project and the target Framework of the project where i want to use this assembly are different. Target framework of assembly project was 4.5 and target framework of my project was 4.0. When I have change the target framework of my project to the target framework of assembly … Read more

A standalone Delphi application that can also be installed as windows service

Totally possible. The trick is to edit the .dpr to create main form when you want to run as an application and the service form when you want to run as a service. Like this: if SvComFindCommand(‘config’) then begin //When run with the /config switch, display the configuration dialog. Forms.Application.Initialize; Forms.Application.CreateForm(TfrmConfig, frmConfig); Forms.Application.Run; end else … Read more

How do you retrieve a list of logged-in/connected users in .NET?

Here’s my take on the issue: using System; using System.Collections.Generic; using System.Runtime.InteropServices; namespace EnumerateRDUsers { class Program { [DllImport(“wtsapi32.dll”)] static extern IntPtr WTSOpenServer([MarshalAs(UnmanagedType.LPStr)] string pServerName); [DllImport(“wtsapi32.dll”)] static extern void WTSCloseServer(IntPtr hServer); [DllImport(“wtsapi32.dll”)] static extern Int32 WTSEnumerateSessions( IntPtr hServer, [MarshalAs(UnmanagedType.U4)] Int32 Reserved, [MarshalAs(UnmanagedType.U4)] Int32 Version, ref IntPtr ppSessionInfo, [MarshalAs(UnmanagedType.U4)] ref Int32 pCount); [DllImport(“wtsapi32.dll”)] static extern void … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)