Running an exe from a .net Windows Service

Madhuri_M

New member
Joined
Aug 22, 2007
Messages
2
Programming Experience
1-3
Hi,
I have written a .net Windows Service which watches a directory and as soon as any files are copied to the directory it FTPs those files. I am running an exe through the Service to FTP the files. But when i start the service FTP is not done. I have set the "Allow Service to interact with Desktop" option in the properties of the Service. After setting the property, the exe is getting executed but still the FTP is not done.

I implemented the same code in windows application and it is working fine. Can anyone suggest a solution.

Following is the code i tried:

Process FTPProcess = new Process();
FTPProcess.StartInfo.UseShellExecute = false;
FTPProcess.StartInfo.FileName = Settings.Default.IPSwitchPath;
FTPProcess.StartInfo.Arguments = "-s " + Settings.Default.FTPSource + " -d " + Settings.Default.FTPDestination;
FTPProcess.StartInfo.RedirectStandardOutput = true;
FTPProcess.Start();
FTPProcess.WaitForExit();

Thanks in advance,
Madhuri
 
Hi Kelphis,

Actually i got the solution. All the while i was running the service in local system account. It worked when i tried running the service in a user account.

Regards,
Madhuri
 
Back
Top