已成功安装 Microsoft 服务,但未在服务列表中看到

Installed Microsoft Service with success, but doesn't see on service list

我需要帮助。 我按照这个tutorial安装了微软服务,成功了,但是我没有在服务列表中看到。

我的服务:

public partial class Service1 : ServiceBase
{
    public Service1()
    {
        InitializeComponent();
    }

    protected override void OnStart(string[] args)
    {

    }

    protected override void OnStop()
    {

    }
}

还有其他安装服务的方式吗?还是我想错了?

我对开发者命令工具的回应:

Beginning the Install phase of the installation. See the contents of the log file for the C:\projects\SimPortalService\SimPortalService\bin\Debug\SimPortalService.exe assembly's progress. The file is located at C:\projects\SimPortalService\SimPortalService\bin\Debug\SimPortalService.InstallLog. Installing assembly 'C:\projects\SimPortalService\SimPortalService\bin\Debug\SimPortalService.exe'. Affected parameters are: logtoconsole = assemblypath = C:\projects\SimPortalService\SimPortalService\bin\Debug\SimPortalService.exe logfile = C:\projects\SimPortalService\SimPortalService\bin\Debug\SimPortalService.InstallLog No public installers with the RunInstallerAttribute.Yes attribute could be found in the C:\projects\SimPortalService\SimPortalService\bin\Debug\SimPortalService.exe assembly.

The Install phase completed successfully, and the Commit phase is beginning. See the contents of the log file for the C:\projects\SimPortalService\SimPortalService\bin\Debug\SimPortalService.exe assembly's progress. The file is located at C:\projects\SimPortalService\SimPortalService\bin\Debug\SimPortalService.InstallLog. Committing assembly 'C:\projects\SimPortalService\SimPortalService\bin\Debug\SimPortalService.exe'. Affected parameters are: logtoconsole = assemblypath = C:\projects\SimPortalService\SimPortalService\bin\Debug\SimPortalService.exe logfile = C:\projects\SimPortalService\SimPortalService\bin\Debug\SimPortalService.InstallLog No public installers with the RunInstallerAttribute.Yes attribute could be found in the C:\projects\SimPortalService\SimPortalService\bin\Debug\SimPortalService.exe assembly. Remove InstallState file because there are no installers.

The Commit phase completed successfully.

The transacted install has completed.

您跳过了文章中的一个重要步骤:

In order to use the steps in this article, you first need to add a service installer to your Windows Service. See Walkthrough: Creating a Windows Service Application in the Component Designer.

您的服务没有安装程序,因此installutil没有工作要做,因为它报告:

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

因此,为您的服务创建一个安装程序。