Excuse my C#... I usually program in VB.
I added a path string and event log, and installed the service.
It worked perfectly. The only thing I can think of that would be failing is the path you're using. If I were you I would add a timer to the service and move the thread start to the timer elapsed event. Then I would compile and install a debug version and attach to the process while it's running on the server. This way you could see the path variable as it's passed.
protected override void OnStart(string[] args)
{
Thread t = new Thread(new ThreadStart(this.Start));
t.Start();
}
private void Start()
{
string path = "\\\\wks116\\Misc";
eventLog1.WriteEntry(path);
//service loop which calls for a directory listing i.e
String[] files = System.IO.Directory.GetFiles(path);
int i = files.GetLength(0);
eventLog1.WriteEntry(i.ToString());
while (i > 0)
{
eventLog1.WriteEntry(files[i - 1]);
i--;
}
}
Quote:
Originally Posted by epikto
As I feared the UNC path direction didn't work.
Any other ideas? I think the key here is the fact that from the main method it works fine versus not when it is called via an class internal call.