• Register
1 vote
433 views

Problem :

I am very new to C#. I am trying to execute my code related to windows service but I am unable to execute the code I am facing below error.

Cannot start service from the command line or debugger. A winwows Service must first be installed(using installutil.exe) and then started with the ServerExplorer, Windows Services Afministrative tool or the NET START command.

I am looking for expert advice on fixing above error as I have already spent a lot of time in fixing it but with no positive results.

8 5 2
3,230 points

Please log in or register to answer this question.

1 Answer

1 vote

Solution :

I had faced this issue before and I was able to fix the above issue with the help of Installing the Service Manually.

To install the service manually please follow below procedure:

To be able to install or uninstall your windows service manually which you had created using the .NET Framework you should use the utility InstallUtil.exe. This very useful tool can be found on below path you should use the appropriate framework version number.

C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\InstallUtil.exe

To install use below command:

installutil yourproject.exe

To uninstall use below command:

installutil /u yourproject.exe

To install the service programmatically please follow below procedure:

You can also install the service programmatically by using the C# with the help of following class ServiceInstaller (c-sharpcorner).

Hope above procedure helps you.

8 4
5,680 points

Related questions

0 votes
1 answer 22 views
0 votes
1 answer 126 views
126 views
Problem : I am trying to install Windows services on my box but I found that there are two different options for automatically starting the Windows service on the Windows startup. First option is Automatic, and Second option is Automatic (Delayed start). ... And the ServiceConfig element there has the DelayedAutoStart attribute. So how will that affect when the services are started at boot time?
asked Dec 2, 2019 alecxe 7.5k points
1 vote
1 answer 945 views
945 views
Problem : Whenever I create the new Windows Service in my Visual Studio 2010, I often face the message stating to use the InstallUtil and after that net start to run the service. I have tried the below steps: 1. I created the new project File -> New -> ... Ran the net start MyTestService. The Output of my step 5 The service name is invalid.More help is available by typing NET HELPMSG 2185.
asked Dec 30, 2019 alecxe 7.5k points
0 votes
1 answer 56 views
56 views
Problems: Little bit confused , Can any one guide me : Which of the following would you NOT see on a Windows 10 Start menu? A. Power B. apps list C. tiles D. Task View
asked Feb 12, 2020 maddi86 5.4k points
0 votes
1 answer 2 views
2 views
Problem: retrieving the com class factory for component with clsid.
asked 4 days ago Ethan ross 1.8k points
2 votes
2 answers 326 views
326 views
Problem: What command line utility can be used to repair the BCD on a Windows installation?
asked Mar 23, 2020 ArifulIslam 7.5k points
0 votes
1 answer 7 views
7 views
Problem: java is not recognized as an internal or external command windows 10
asked 3 days ago Hira 2.2k points
0 votes
1 answer 86 views
86 views
Problem : I have one entity type called product which is generated by the entity framework. I have tried to write below query public IMyQueryable<Product> GetProducts(int myCategoryID) {     return from prod in db.Products     where prod.CategoryID== myCategoryID     select ... one select new Product { Name = p.Name}; it miraculously works correctly. How can I perform the custom select section?
asked Jan 27, 2020 jwilliam 3.9k points
0 votes
1 answer 225 views
225 views
Problem : I am troubled by following error skipped loading symbols. module is optimized and the debugger option 'just my code' is enabled.
asked Nov 13, 2019 peterlaw 6.9k points
0 votes
1 answer 16 views
16 views
Problem: if x windows fails to start, what command can be used to troubleshoot the issue?
asked Jul 22, 2020 conner 1.5k points