15

I just installed a windows service using VS 2010, using the installutil.exe, the cmd prompt window said the commit phase completed successfully, but I cannot see the windows service in the local services folder.

What did I miss here?

I am using Windows 7 and VS 2010

UPDATE:
I un-installed the service (which was named service1) changed the name to something that made sense, installed the service (same process as above), still cannot find it in the services browser.

FWIW... I renamed my service1.cs in the properties window (filename value).. but it was still showing service1 in the services browser. I ended up changing the values in the code behind as well (auto generated code) this.serviceInstaller1.ServiceName = "service1";

Update (2) I created a dummy windows service, and was able to successfully install that (it prompted me for Domain Login ID & password) and I was able to see it in the services browser.

However, I am not able to see the actual windows service (related to my project) in the services browser. Obviously I have permissions, since I was able to install the dummy service.

According this this site Can't see windows service after installation

I cannot see the service in the registry in "HKLM\System\CurrentControlSet\Services" path.

Update (3)
The log file says

No public installers with the RunInstallerAttribute.Yes attribute could be found in the C:..

however, I do have a ProjectInstaller.cs file in the project solution.

I added

[RunInstaller(true)]

to the ProjectInstaller.cs file, still no luck

Any suggesstions?

Giulio Caccin
  • 2,962
  • 6
  • 36
  • 57
user788487
  • 259
  • 3
  • 6
  • 11
  • Have you refreshed the services folder view? Sometimes it doesn't show up immediately. – Jackson Pope Jun 22 '11 at 14:32
  • @user788487: What did you set the ServiceName property of the ServiceInstaller to? That's what it should be listed under. – Jackson Pope Jun 22 '11 at 14:37
  • @Jackson, can't find it under that name either. – user788487 Jun 22 '11 at 14:50
  • What is your path that you are passing to installutil.exe? You're not using a mapped drive or anything like that? – Chris O Jun 22 '11 at 20:23
  • well, I am able to install the dummy service successfully.... so I don't think its the install process. But to answer your question, in the cmd prompt, I do "cd C:\Windows\Microsoft.NET\Framework\v4.0.30319" and then "installutil " – user788487 Jun 22 '11 at 20:28
  • Doesn't installutil output a log file that you can check for errors? Edit: run it again with /logfile specified http://msdn.microsoft.com/en-us/library/50614e95(v=vs.80).aspx – Dave Ziegler Jun 22 '11 at 20:50
  • @Jack, the log file says "No public installers with the RunInstallerAttribute.Yes attribute could be found in the C:\....." though I do have a ProjectInstaller.cs file in the project. – user788487 Jun 23 '11 at 11:58
  • Maybe you need to redo the project installer stuff. I'm looking at a simple win service I built, and I have (looking at ProjectInstaller.cs designer): serviceProcessInstaller1 with Account, GenerateMember, HelpText, Modifiers, and Parent (ProjectInstaller), then I have: serviceInstaller1 with Description, DisplayName, GenerateMember, Modifiers, Parent, ServiceName, ServicesDependedOn, StartType. Do you have both of those included in your ProjectInstaller designer and are all their properties set correctly? Pay special attention to the service name stuff. – Dave Ziegler Jun 23 '11 at 15:37
  • yes, I do have both in the designer and the properties are set as you indicated. – user788487 Jun 23 '11 at 15:41
  • I had the exact same problem; changed the access of ALL classes - the installer and the service class itself - to `public` and it worked for me. – yati sagade Jun 29 '12 at 06:06
  • 1
    Try http://stackoverflow.com/questions/1560407/windows-service-not-appearing-in-services-list-after-install . – Benhar Upasana Oct 25 '13 at 06:39

8 Answers8

9

Also remember to check what name you've given your service before you look for it in the list. I copy-pasted some code from the net and forgot to change the name of the service in the code so of course I couldn't find it...

serviceInstaller.DisplayName = "Example service"

Doh!

Ben Adams
  • 564
  • 1
  • 4
  • 18
5

Check if you have something like this in the constructor of the Installer derivated class with the [RunInstaller(true)] attribute:

public ServiceSetup()
{
    Installers.Clear();

    ServiceInstaller serviceInstaller = new ServiceInstaller();
    // serviceInstaller.Description = // FIXME:
    // serviceInstaller.ServiceName = // FIXME:
    // serviceInstaller.DisplayName = // FIXME:
    serviceInstaller.StartType = ServiceStartMode.Automatic;
    Installers.Add(serviceInstaller);

    ServiceProcessInstaller serviceProcessInstaller = new ServiceProcessInstaller();
    serviceProcessInstaller.Account = ServiceAccount.LocalSystem;
    serviceProcessInstaller.Username = null;
    serviceProcessInstaller.Password = null;
    Installers.Add(serviceProcessInstaller);
}
Żubrówka
  • 730
  • 1
  • 10
  • 24
2

Make the the class where you added [RunInstaller(true)] public.

Dave Ziegler
  • 1,737
  • 3
  • 19
  • 36
  • I think there is a pretty limited set of reasons for "No public installers with the RunInstallerAttribute". Have you removed the installer and walked through that process again? It sounds like something was missed the first time through. – Dave Ziegler Jun 23 '11 at 19:44
1

I just came across this issue exactly as you describe it it.

I was stupidly running the installutil against the generated myservice.vshost.exe file.

This likely wasn't your issue, but in command prompt, I browsed to the directory where the .exe lives, typed installutil followed by a space then cycled using tab to autocomplete the service exe name.

The file I found started with "myservice" and ended with ".exe" and I let it run.

Silly, but that's what happened.

Leaving this message for posterity and with the hope it may help someone else :-)

ozz
  • 5,098
  • 1
  • 50
  • 73
0

I was running the installutil.exe against a file which i thought did not have the .exe extension. When I view files in the fileexplorer, the extensions are not visible. When i added the .exe extension to the service file name, it ran smoothly :-). What a bummer.

christiandersen
  • 193
  • 1
  • 5
  • Welcome to Stackoverflow.Read the FAQ before answering.Please read the queestion carefully before answering.. – coder Mar 29 '13 at 11:17
0

To add a custom action to the setup project

1.In Solution Explorer, right-click the setup project, point to View, then choose Custom Actions. The Custom Actions editor appears.

2.In the Custom Actions editor, right-click the Custom Actions node and choose Add Custom Action. The Select Item in Project dialog box appears.

3.Double-click the application folder in the list box to open it, select primary output from MyNewService (Active), and click OK. The primary output is added to all four nodes of the custom actions � Install, Commit, Rollback, and Uninstall.

4.Build the setup project.

Benhar Upasana
  • 235
  • 2
  • 9
0

It sounds weird but make sure the service.exe file you are trying to install is the latest build. I'm afraid you are try to deploy the files in debug folder but you did make change and rebuild the service project in release mode.

Chinh Phan
  • 1,459
  • 19
  • 22
0

This is semi-solution at best.

I had the same problem and I have tried all remedies mentioned above and on other programmers' havens.

I have changed Acount type to LocalService and now it works fine. This could be interim solution.

Deka
  • 131
  • 1
  • 4
  • 12