2009-08-06 199 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。我錯過了什麼嗎?

回答

1

我們可以看到代碼嗎?

你對Description屬性有什麼建議?您是否在服務MMC中單擊了F5(刷新)?

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刷新窗口,看看它是否存在。