Environment.CurrentDirectory isn't working for Windows Services

by Dominic Zukiewicz 18. October 2007 10:06
The admin's decided to run my Windows Service under the NetworkService account to improve security. The problem is that where I thought I was saving temporary files to the directory of my application using Environment.CurrentDirectory , it was retrieving C:\windows\system32 ???? I therefore had to change the way I retrieved the local directory to: string directory = new FileInfo(Assembly.GetExecutingAssembly().Location).DirectoryName; This means that any logging files that used to be xxx.log, now have to give their full path.

Tags:

Framework | Windows Services

Powered by BlogEngine.NET 1.5.0.7
Theme by Interakting

Interakting

A full service digital agency offering online strategy, design and usability, systems integration and online marketing services that deliver real business benefits and ensure your online objectives are met.

Calendar

<<  July 2010  >>
MoTuWeThFrSaSu
2829301234
567891011
12131415161718
19202122232425
2627282930311
2345678

View posts in large calendar