Thursday, 3 October 2013

C# Windows Service with log4net - Error 1053: The Service did not respond to start or control in a timely fashion

C# Windows Service with log4net - Error 1053: The Service did not respond
to start or control in a timely fashion

When I install my windows service I get this error when I try to re-start
the service. I'm suspecting that log4net is causing some issues. I checked
the log4net log file can still continue to append, other directories exist
as per installer's File System on Target Machine setup.
Application: SPIDFileWatcher.exe
Framework Version: v4.0.30319
Description: The process was terminated due to an unhandled exception.
Exception Info: System.IO.DirectoryNotFoundException
Stack:
at System.IO.__Error.WinIOError(Int32, System.String)
at System.IO.FileSystemEnumerableIterator`1[[System.__Canon, mscorlib,
Version=4.0.0.0,Culture=neutral,
PublicKeyToken=b77a5c561934e089]].CommonInit()
at System.IO.FileSystemEnumerableIterator`1[[System.__Canon, mscorlib,
Version=4.0.0.0,Culture=neutral,
PublicKeyToken=b77a5c561934e089]]..ctor(System.String, System.String,
System.String, System.IO.SearchOption,
System.IO.SearchResultHandler`1<System.__Canon>)
at System.IO.Directory.EnumerateFiles(System.String, System.String,
System.IO.SearchOption)
at FileWatchingService.FileWatcher..ctor()
at FileWatchingService.WatchService.OnStart(System.String[])
at FileWatchingService.WatchService.OnDebug()
at FileWatchingService.Program.Main()
How can I fix this?