Prasad Godbole

Prasad Godbole

  • NA
  • 153
  • 171.3k

Need Help - Windows service and other EXE execution path problem

Dec 21 2011 12:47 AM
Hi,

We are using Visual studio 2005 and .NET Framework 2.0

We have created and installed one windows service at following location

E:\XMLService

and on start of service we have called following code

System.IO.Directory.SetCurrentDirectory(System.AppDomain.CurrentDomain.BaseDirectory)


We have one "XMLTransfer.EXE" EXE at following location

E:\XMLServiceEXE


The windows service is calling "XMLTransfer.EXE" EXE using


Process.Start("E:\XMLServiceEXE\XMLTransfer.EXE")


There are some folder paths which contains the XML files. The fodlers are

E:\XMLFILES  - This contains the XML files

E:\XMLFILES\Log - This contains the log file to write operation of service and "XMLTransfer.EXE" EXE

E:\XMLFILES\Archives - In this folder we copy files from E:\XMLFILES through "XMLTransfer.EXE" EXE

E:\XMLFILES\Error - In this folder we copy files from E:\XMLFILES through "XMLTransfer.EXE" EXE


The problem is when we are starting the service, "XMLTransfer.EXE" EXE not gettng the XMLFILES, Log, Archives and Error folders paths. First time it was worked successfully and "XMLTransfer.EXE" was copying files from E:\XMLFILES to the required locations. But after that it was stopped and "XMLTransfer.EXE" EXE was giving error that Archives fodler is not present though it was present. Its something working abnormally.

When we copy the "XMLTransfer.EXE" EXE at the installed location of windows service i.e. at E:\XMLService and everything was started working fine.

But we want to keep windows service and "XMLTransfer.EXE" EXE paths different.  I think this is something related to service assembly path, "XMLTransfer.EXE" EXE path and other folders path.

We had developed such types of applications using .NET 1.1 but we never faced such abnormal behaviour.

Please help us in this if someone has any idea.


Thanks and Regards

Prasad

Attachment: sample-code.zip

Answers (15)