Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

problem in case of window service

Tags:

c#

windows

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 same 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.

like image 205
PrateekSaluja Avatar asked Dec 06 '25 04:12

PrateekSaluja


1 Answers

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".

like image 167
Benjamin Podszun Avatar answered Dec 08 '25 16:12

Benjamin Podszun