October 11th, 2003, 02:36 PM
TypeInitializationException and Windows Service
Hi, I'm writing a Windows Service that launches a Windows App on startup. So, what I did was, in OnStart( ):
System.Diagnostics.Process process = System.Diagnostics.Process.Start("C:\\Program Files\\Testing\\ThisWinApp.exe");
I successfully installed the service using InstallUtil.exe. When I "start" the service, I keep getting "TypeInitializationException". Account used in ServiceProcessInstaller is "LocalSystem" - does it has permission to run executable and run exe in "Program Files" folder? I can't configure these rights on my XP machine.
Anyway, I used caspol.exe to check permission on the assembly. Intersecting permission from across "level", the assembly (the Windows Service) got "Fulltrust". So, if it's got to do with security, it must be user role launching/starting the service.
Now, if it's not security, perhaps it's got to do with the fact that any class derived from ServicedBase can't launch anything that has a GUI?
Thanks in advance.
Click Here to Expand Forum to Full Width
This is a Codeguru.com survey!