Вопрос

I have been trying to install a Windows service using installutil: installutil /u GSIS.FileMoverService.exe.

The output I get is :

Uninstalling assembly 'C:\FMS\GSIS.FileMoverService.exe'. Affected parameters are:

logtoconsole = logfile = C:\FMS\GSIS.FileMoverService.InstallLog

assemblypath = C:\FMS\GSIS.FileMoverService.exe Removing EventLog source File Mover Service.

Warning: The source File Mover Service is not registered on the local machine. Service File Mover Service is being removed from the system...

An exception occurred during the uninstallation of the System.ServiceProcess.ServiceInstaller installer. System.ComponentModel.Win32Exception: The specified service does not exist as an installed service An exception occurred while uninstalling.

This exception will be ignored and the uninstall will continue. However, the application might not be fully uninstalled after the uninstall is complete.

The service has been stopped when I try to uninstall. It's definitely registered as a services. I've rebooted and it's still visible in the Services applet (services.msc). It also starts and stops successfully from the Services applet, so it doesn't look like it's been unsuccessfully (or only partially) installed.

I am calling installutil from the VS2010 Command Prompt (having clicked Run As Administrator).

Any ideas?

Это было полезно?

Решение

In the end I used sc delete GSIS.FileMoverService to remove the service. This worked.

Другие советы

So I expect this has to do with your class that is extending System.Configuration.Install.Installer. In the constructor of your class, you are expected to add a System.ServiceProcess.ServiceProcessInstaller and System.ServiceProcess.ServiceInstaller to Installers like:

public MyServiceInstaller(string displayName = null, string description = null, ServiceAccount account = ServiceAccount.LocalSystem, string username = "", string password = "", ServiceStartMode startType = ServiceStartMode.Automatic, bool delayedAutoStart = false, string[] servicesDependedOn = null)
{
    Installers.Add(new ServiceProcessInstaller
        {
            Account = ServiceAccount.LocalSystem,
            Username = username,
            Password = password
        });
Installers.Add(new ServiceInstaller
    {
        ServiceName = GetType().Name,
        StartType = startType,
        DisplayName = displayName ?? serviceName,
        Description = description ?? string.Empty,
        ServicesDependedOn = servicesDependedOn,
        DelayedAutoStart = delayedAutoStart
    });

}

The ServiceName in ServiceInstaller needs to match the ServiceName assigned to the ServiceInstaller when the service was installed. If it does not, then you will get this exception because it cannot find the service installed before it tries to uninstall.

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top