shabrandi
asked on
windows service in C#
hi, i have a windows service in win 7, my service will run an exe to mailing a folder at specified time,but when the exe run by the service , it don't work and throw this error
object refrence not set to an instance of an object.
but send my error report mail
when i run my exe it works.
what should be this issue? is there any solution for this
the code to run my app in the service is :
ProcessStartInfo pInfo = new ProcessStartInfo(path);
Process pHandle= Process.Start(pInfo);
if (pHandle != null)
{
pHandle.WaitForExit();
pHandle.Close();
}
object refrence not set to an instance of an object.
but send my error report mail
when i run my exe it works.
what should be this issue? is there any solution for this
the code to run my app in the service is :
ProcessStartInfo pInfo = new ProcessStartInfo(path);
Process pHandle= Process.Start(pInfo);
if (pHandle != null)
{
pHandle.WaitForExit();
pHandle.Close();
}
Does the exception thrown include the line of code that throwing the exception?
ASKER
i don't know whitch line exactlly throwing this but i think it should be the part of code that attempt to the directory of folder
can it be an access permmission probelm ?
the directory is not in use or not locked
can it be an access permmission probelm ?
the directory is not in use or not locked
ASKER
the exeption throwing in my app code
Can you tell me if your exe is a console application? a window app will not run if being fired from a windows service
ASKER
it's a windows app, so if i change to console app it will work ?
ASKER
i don't need user interface,i can use console if it will work
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
thx so,u right
ASKER
sorry ,the result is same in console app,the application(both of win app or console app) will run and send me it's Exeptions by mailing,but can't sent the folder
ASKER
the Exeption is in access to windows registry keys, before sending the folder
a method should get the folder information from windows registry but can't do this
a method should get the folder information from windows registry but can't do this