problem in case of window service
i made a windows service & add project installer.in which only contain this code. System.Diagnostics.Process.Start(@"C:\Windows\system32\notepad.exe"); inside the timer tick event & interval is 60 sec.i just wanted to try to run Windows service.
1st-serviceProcessInstaller1 i have been changed its account setting as local system. 2nd-serviceInstaller1 in this case i have been changed its start up type as Automatic. then i create a setup add another project then right click add project output then add primary output then press ok. then go to Right click on project->view->custom Action->right click on Install->Add custom Action->select Application folder & add primary output.the sam开发者_运维知识库e thing done for all the remaining options like commit,rollback,uninstall.
after that i build the setup it build succesfully then i install the setup it installed properly into program file n create one .exe file n one Instalfile. but problem is that when i search the service into "services.msc" the service is not there. means service is not showing there.i tried but not getting the ans.plz help me to solve this problem.
Not the answer to your original question, but
- Starting an application with a GUI from a service is a bad idea (tm) and won't work in the majority of cases
- Check what kind of Timer you use. .Net provides 3 Timer classes, not all of them work in a service (because they depend on a window's message loop, iirc)
To test any service: Why don't you go for the installutil binary first (bypassing the setup project)? You find it in your framework directory, for example in "C:\Windows\Microsoft.NET\Framework\v2.0.50727".
I'd suggest trying to install the assembly manually to see if you get any kind of error message.
Just open a Visual Studio command prompt and run InstallUtil.exe [YourService].exe
. At least you'll know if it installed properly.
Even better option is to use the command line tool sc.exe Try "sc create /?" on command line and see its options. You can then use "sc start " , "sc stop " & "sc query " to control service. You can use sc.exe to send custom command to the service. Check windows event log for errors related to service installation. It may be .Net version used to create it is not on target machine.
精彩评论