2009-08-06 5 views
3

Я пытаюсь установить первый сервис, который я написал с помощью:Установка .NET службы Windows

installutil XMPPMonitor.exe 

я получаю следующее сообщение:

Running a transacted installation. 

Beginning the Install phase of the installation. 
See the contents of the log file for the E:\Documents\Projects\XMPPMonitor\XMPPMonitor\bin\Debug\XMPPMonitor.exe assembly's progress. 
The file is located at E:\Documents\Projects\XMPPMonitor\XMPPMonitor\bin\Debug\XMPPMonitor.InstallLog. 

The Install phase completed successfully, and the Commit phase is beginning. 
See the contents of the log file for the E:\Documents\Projects\XMPPMonitor\XMPPMonitor\bin\Debug\XMPPMonitor.exe assembly's progress. 
The file is located at E:\Documents\Projects\XMPPMonitor\XMPPMonitor\bin\Debug\XMPPMonitor.InstallLog. 

The Commit phase completed successfully. 


The transacted install has completed. 

Но я не устанавливать службу в списке когда я запускаю services.msc. Я что-то упускаю?

ответ

2

Убедитесь, что вы правильно создали и настроили ServiceInstaller и ServiceProcessInstaller. Это то, что installutil использует для фактического регистрации каждой службы в процессе.

1

можно ли увидеть код?

Что у вас есть для атрибута Description? Вы нажали F5 (Обновить) в MMC Services?

public class WindowsServiceInstallerEx : ServiceInstaller 
{ 

    [ComponentModel.Description("A lengthy description of the service that will display in the Description column of the Services MMC applet.")] 
    public string ServiceDescription 
    { 
    get { return serviceDescription; } 
    set { serviceDescription = value; } 
    } 

    public override void Install(System.Collections.IDictionary stateSaver) 
    { 
    base.Install (stateSaver); 

    Microsoft.Win32.RegistryKey serviceKey = null; 
    try 
    { 
     string strKey = string.Format(@"System\CurrentControlSet\Services\{0}", this.ServiceName); 

     serviceKey = Microsoft.Win32.Registry.LocalMachine.OpenSubKey(strKey, true); 
     serviceKey.SetValue("Description", this.ServiceDescription); 
    } 
    finally 
    { 
     if (serviceKey != null) 
     serviceKey.Close(); 
    } 
    } 

    private string serviceDescription; 
} 
1

Возможно, вам потребуется обновить окно services.msc, иногда оно не обновляет его, если вы все время открываете его. Нажмите F5, чтобы обновиться до окна и посмотреть, есть ли там.

2

Я задал подобный вопрос в последнее время: C#: Running and Debugging a Windows Service

Видимо проблема была, потому что не имеет Installer прилагается к услуге.

Here - это учебное пособие, которое я использовал для добавления Service Installer и так далее.