开发者

Cannot find windows service (just installed)

开发者 https://www.devze.com 2023-03-14 12:52 出处:网络
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 servi

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 brow开发者_如何转开发ser. 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?


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!


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);
}


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


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 :-)


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.


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.


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.


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消