vs 服务做成安装包,如何安装以后启动服务,只要在类名为projectinstaller的类中重写commit事件即可
public override void Commit(IDictionary savedState)
{
base.Commit(savedState);
ServiceController sc = new ServiceController("HttpProviderService");
if (sc.Status.Equals(ServiceControllerStatus.Stopped))
{
sc.Start();
}
}
{
base.Commit(savedState);
ServiceController sc = new ServiceController("HttpProviderService");
if (sc.Status.Equals(ServiceControllerStatus.Stopped))
{
sc.Start();
}
}