• Register
1 vote

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 -> Project -> Windows Service

2. Gave the Project Name: MyTestService

3. Build my project as is (Service1 constructor, OnStart, OnStop)

4. I opened the command prompt, and ran "C:\Windows\Microsoft.NET\Framework\v4.0.30319\InstallUtil.exe" MyTestService.exe

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

7.5k points

Please log in or register to answer this question.

1 Answer

0 votes

Solution :

 Please be sure that your ProjectInstaller class should be public. To be very precise I added the event handlers to my ProjectInstaller.Designer.cs, as shown below :

this.serviceProcessInstaller1.BeforeInstall += new System.Configuration.Install.InstallEventHandler(this.serviceProcessInstaller1_BeforeInstall);

I think during your automatical process of creating the handler function in the ProjectInstaller.cs it might have changed my class definition from

public class ProjectInstaller : System.Configuration.Install.Installer

to the

partial class ProjectInstaller : System.Configuration.Install.Installer

so replacing your public keyword with the partial. That is why, in order to fix the issue it must be done as

public partial class ProjectInstaller : System.Configuration.Install.Installer

Also note that I use the Visual Studio 2013 Community edition.

38.6k points

Related questions

0 votes
1 answer 19 views
Problem: Where should I look for help with this issue : Windows was unable to open service control manager?
asked May 22 Florina Gulnar 106k points
0 votes
1 answer 8 views
Problem: Is there a possibility to resolve this issue : No public installers with the runinstallerattribute yes?
asked Jun 24 Shima 126k points
0 votes
1 answer 10 views
Problem: Please help me, I need help here: No public installers with the runinstallerattribute.yes attribute could be found
asked Jun 14 asha 121k points
0 votes
1 answer 4 views
Problem: Net view the service is not started?
asked 2 days ago Mezbah 130k points
0 votes
1 answer 1 view
1 view
Problem: Net view the service is not started?
asked 2 days ago Mezbah 130k points
0 votes
1 answer 8 views
Problem: Give me an answer please : Service did not start due to logon failure
asked May 31 Chi Omega 168k points
0 votes
1 answer 4 views
Problem: Local service and no impersonation windows 7
asked Jul 11 Shifa 18.2k points
0 votes
1 answer 21 views
Problem: I've also tried to revert sources to the last working version, but nothing else happens: net start outputs: The service is not responding to the control function. What could cause this malfunction?
asked Mar 20 ummesalma 29.1k points
0 votes
1 answer 14 views
Problem: My sql server shows this error after moving a folder to another driver: Windows could not start the sql server on local computer. :
asked Apr 26 PkGuy 25.9k points
0 votes
1 answer 185 views
Problem: My Audio Service refuses to function properly. I have tried so many different solutions I can't even recall all of them. Here's how it started; I got home from work one day to see my computer has no video signal but is turned on and receiving input from my ... even though the service turned on and I can see all my devices. As an attempt I tried to do test sound, and this error appears.
asked Apr 26 sumaiya simi 43.9k points