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

6 5 3
7,540 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.

9 7 4
38,600 points

Related questions

1 vote
1 answer 314 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. ... 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.
asked Apr 10, 2020 morrisBson 3.2k points
1 vote
1 answer 33 views
Problem : I am very new to Windows Services. Currently I am trying to create a custom windows service. I am trying to create the deployment package using the InstallShield and also the installation prompts for a user name and a password for a service Log On account. I did not had ... ;t still confirm whether a issue is to do with a OS or it is specific to machine that I am trying to install it on.
asked Apr 25, 2020 stewart 4k points
0 votes
1 answer 84 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
0 votes
1 answer 100 views
Problem : I am trying to use the WCF4.0 template -REST. Also I am trying to make the method that uploads a file using the stream. The problem always occur at below line of code: Stream myserverStream = myrequest.GetRequestStream() ... connectFailure, Socket s4, Socket s6, Socket& socket, IPAddress& address, ConnectSocketState state, IAsyncResult asyncResult, Int32 timeout, Exception& exception)
asked Dec 10, 2019 alecxe 7.5k points
0 votes
1 answer 10 views
0 votes
1 answer 14 views
Problem: I am naive to Asp.Net.I am having a weird looking problem where I am trying to open up my ASP.NET MVC application but I am receiving the below ASP.NET error page which says: Server Error in '/' Application. The resource cannot be found. Description: ... unknown reason to me it seems like it is actually searching for the .aspx file. Please guide me if you think I am missing something.
asked Aug 19, 2020 Raphael Pacheco 4.9k points
1 vote
3 answers 1.5K views
Problem : I am very new to unity. Recently I had updated my unity from the earlier unity5 to the current 2018.2.2f1. And after that update my Unity scripts are not at all loading. I had also tried to play my Scene but my scripts are not at all loading and I am ... time on fixing above error but still unable to fix it so looking for the expert help who can help me in fixing my issue in less time.
asked Apr 10, 2020 morrisBson 3.2k points
0 votes
0 answers 14 views
Problem: Which of the following storage space types can only be created with three or more physical disks? Two-way mirror, striped, simple, three-way mirror, or parity
asked Jul 21, 2020 HenryL 620 points
0 votes
1 answer 49 views
Problem : Whenever I want to copy my 4 files into the bin folder, when I stop the main service, I always face an error with the one particular file (e.g. TexteDll). The error is as follows : Cannot copy TexteDll: The requested operation cannot be performed on a ... may be due to some system locking. Or may be another process is using that DLL. Can someone suggest a cause or solution for this ?.
asked Dec 6, 2019 alecxe 7.5k points