I had made a windows service in visual studio 2008 in C#. inside the service i had written only single line code
try
{
System.Diagnostics.Process.Start(@"E:\Users\Sk\Desktop\category.txt");
}
catch { }
then i add the project installer & change the serviceProcessInstaller1 Account property as local system Also change the serviceInstaller1 start type property as Automatic.
then i build the project.it was successful. after that i add another project that was setup project.i had added primary project output & i had added the custom action as “Primary output from DemoWindowsService (Active)”.then built the setup.setup was build successfully.then i install the setup & then went to services start the service.service stated properly but it was not performing the task.
i had checked the path is correct & also i tried to do
System.Diagnostics.Process.Start(@"E:\Windows\system32\notepad.exe") but still result is same.i tried a lot but not getting the answer.
If it’s not working, then maybe it’s because an exception was thrown. However, since you’re hiding all exceptions with your try/catch block, you’ll never know what’s wrong.
Get rid of the try/catch block, and see if that helps you learn what’s wrong.