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

Comments

4/3/2008 7:32:17 PM #

Read this http://bytes.com/forum/thread257268.html. I have the same problem and this articles give me some ideas.

Hernan |

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

<<  February 2012  >>
MoTuWeThFrSaSu
303112345
6789101112
13141516171819
20212223242526
2728291234
567891011

View posts in large calendar