Win Service 程序集中可能可以找到“Yes”屬性。錯誤

出現如上錯誤碼,解決辦法如下,在項目中加一個ProjectInstall.ca

 

代碼

 

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

namespace WeatherService
{  
    /// <summary>
    /// myInstall 的摘要說明。
    /// </summary>
    ///
    [RunInstaller(true)]
    public class myInstall : Installer
    {
        private ServiceInstaller serviceInstaller;
        private ServiceProcessInstaller processInstaller;
        public myInstall()
        {
            processInstaller = new ServiceProcessInstaller();
            serviceInstaller = new ServiceInstaller();

            processInstaller.Account = ServiceAccount.LocalSystem;
            serviceInstaller.StartType = ServiceStartMode.Automatic;
            serviceInstaller.ServiceName = "WeatherService";

            Installers.Add(serviceInstaller);
            Installers.Add(processInstaller);
        }
    }


}

 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章