locked
How can i restart a window service in windows 7 RRS feed

  • Question

  • i have window service application in C#.NET i want to restart my winservice with another application plz anyone can tel how can i do this plz reply thanks

    Thursday, February 25, 2010 6:17 PM

Answers

  • Thanks Andre.Ziegler Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals

    my application is unable to start service in windows 7 when user controls are on but with  Xp and older version it is working fine
    Friday, February 26, 2010 1:19 PM

All replies

  • Hi,

    simly run "net stop <servicename>" to stop the service and "net start <servicename>" to start the service. .net framework also includes classes to natively start/stop services:

    http://www.dotnetspider.com/resources/865-How-start-stop-windows-services-programmati.aspx

    André

    "A programmer is just a tool which converts caffeine into code" CLIP- Stellvertreter http://www.winvistaside.de/
    Thursday, February 25, 2010 11:12 PM
  • Thanks Andre.Ziegler Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals

    my application is unable to start service in windows 7 when user controls are on but with  Xp and older version it is working fine
    Friday, February 26, 2010 1:19 PM
  • sure, with UAC turned on you have standard user rights and under XP you've used an account with administrator rights! So change the requestedExecutionLevel entry inside the manifest of your application to requireAdministrator. When you start the application, you have to accept the UAC prompt to get administrator rights for your application, so that you can start/stop the service.

    André
    "A programmer is just a tool which converts caffeine into code" CLIP- Stellvertreter http://www.winvistaside.de/
    Friday, February 26, 2010 4:18 PM
  • my app is running on client's computer. Is there any way UAC don't promt to get  administrator rights for my application and service start
    i am very thanks full to you for your coperation Ziegler Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals

    Friday, February 26, 2010 5:39 PM
  • you can use the taskscheduler to start your application with admin rights:

    http://www.msfn.org/board/topic/135472-faq-what-is-the-uac-part2/

    André

    "A programmer is just a tool which converts caffeine into code" CLIP- Stellvertreter http://www.winvistaside.de/
    Friday, February 26, 2010 8:43 PM
  • Sorry i came back too late Thanks for the help now my app is working thanks u a lote
    Saturday, March 6, 2010 4:59 PM