C# 服务不会部署在服务器上

C# 服务不会部署在服务器上,c#,windows-services,C#,Windows Services,正在尝试将服务安装到当前在.Net Framework 2.0下运行的服务器上。当我从安装项目运行.MSI文件时,所有内容都被复制过来,但是当我在SMC下检查时,服务不在那里。此外,当我尝试使用InstallUtil安装服务时,系统会提示在程序集中找不到具有runInstallerAttribute.Yes属性的公共安装程序。当我检查ProjectInstaller.cs时,一切看起来都正常。另外,我可以在我的计算机上安装fine,并且我对服务器和我的设备都有管理员权限 这是ProjectIns

正在尝试将服务安装到当前在.Net Framework 2.0下运行的服务器上。当我从安装项目运行.MSI文件时,所有内容都被复制过来,但是当我在SMC下检查时,服务不在那里。此外,当我尝试使用InstallUtil安装服务时,系统会提示在程序集中找不到具有runInstallerAttribute.Yes属性的公共安装程序。当我检查ProjectInstaller.cs时,一切看起来都正常。另外,我可以在我的计算机上安装fine,并且我对服务器和我的设备都有管理员权限

这是ProjectInstaller.cs文件

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Configuration.Install;


namespace MyService
{
    [RunInstaller(true)]
    public partial class ProjectInstaller : Installer
    {
        public ProjectInstaller()
        {
            InitializeComponent();
        }
    }
}
编辑:服务器当前正在运行Windows 2003 R2 Service pack 2。
个人电脑运行的是Windows 7和Visual Studio 2010

以下是一些安装服务的代码示例:

[RunInstaller(true)]
public class InstallMyService : Installer
{
    public InstallMyService()
    {
        var svc = new ServiceInstaller();

        svc.ServiceName = "MyService";
        svc.Description = "This is a service";
        svc.DisplayName = "My Service";
        svc.StartType = ServiceStartMode.Automatic;

        var svcContext = new ServiceProcessInstaller();
        svcContext.Account = ServiceAccount.LocalSystem;

        Installers.Add(svc);
        Installers.Add(svcContext);
    }
}

关于哪台服务器可能比较好的信息(只有六台左右),以及您尝试运行安装所使用的帐户的信息。就是这样。然而,这与VS2010在为服务创建安装程序时自动生成的内容有什么区别呢?我不能说。上面的技术最初是从MSDN站点上的示例代码复制而来的,尽管我已经没有参考资料了。