Windows service always writes to custom log and application log
问题 I am using a custom EventLog for my Windows service. The service creates the event source after installtion. I don't have any problems. However, I have setup my service so that I can run it from the IDE using the following mechanism: static void Main(string[] args) { AppDomain.CurrentDomain.UnhandledException += new UnhandledExceptionEventHandler(UnhandledException); string firstArgument = string.Empty; if (args.Length > 0) firstArgument = args[0].ToUpperInvariant(); if (string.Compare