cannot open window service on computer '.' in window application

Issue

I develop one window application and I also create one service. I start the service using coding in window application, but I am getting an error like cannot open window service on computer '.'

I have used below code.

ServiceController controller = new ServiceController("SeoMozScheduleService");

if (controller.Status == ServiceControllerStatus.Stopped)
{
    controller.Start();
}

If i right click on Application and click on Run as Administrator than it works fine for me…

Solution

Go to
c://Program Files/ApplicationFolder/.exe
Right-click on .exe and go to Properties then go Compatibility Tab and check true to Run this Program as an administrator Level.

Answered By – Kartik Patel

This Answer collected from stackoverflow, is licensed under cc by-sa 2.5 , cc by-sa 3.0 and cc by-sa 4.0

Leave a Reply

(*) Required, Your email will not be published