Hello,
I've recently created a Windows Service(C#) which does exactly what I want it to do, however. Upon putting certain settings into a configuration file so the Server Manager can change its settings when required, the service cannot access the file.
I've tried the following without success:
I'm really not sure what else i can try. The FileStream line of code is below:
FileStream stream = new FileStream(Path.GetDirectoryName(Path.Combine(dir, @"\Config\Settings.xml")), FileMode.Open, FileAccess.Read);
The error message I get is as follows:
Service cannot be started. System.UnauthorizedAccessException: Access to the path 'C:\Ultilearn Account Listener\Config' is denied. at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath) at System.IO.FileStream.Init(String path, FileMode mode, FileAccess access, Int32 rights, Boolean useRights, FileShare share, Int32 bufferSize, FileOptions options, SECURITY_ATTRIBUTES secAttrs, String msgPath, Boolean bFromProxy) at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access) at AccountListener.AccountListener.GetNodeValue(String path) at AccountListener.AccountListener.GetSettings() at AccountListener.AccountListener.OnStart(String[] args) at System.ServiceProcess.ServiceBase.ServiceQueuedMainCallback(Object state)
Thanks in advance for any and all help.