Windows无法在本地计算机上启动该服务。 [英] Windows could not start the service on a local computer"

查看:553
本文介绍了Windows无法在本地计算机上启动该服务。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我创建了一个带有Windows服务的WCF库,我已经使用installutil安装了我的服务,但它已成功安装,但我无法启动该服务。当我启动服务时,我收到以下错误



Windows无法在本地计算机上启动Service1服务



错误1067:进程意外终止。



这是我用过的例子



http://msdn.microsoft.com/en-us/library/ff649818.aspx [ ^ ]

I have created a WCF library with windows service and i have installed my service using installutil and it is successfully installed but i am unable to start the service.When i start the service i am getting below error

"Windows could not start the Service1 service on a local computer"

Error 1067:The process terminated unexpectedly.

This is the example i have used

http://msdn.microsoft.com/en-us/library/ff649818.aspx[^]

推荐答案

在设计模式下。右键单击 - >添加安装程序。我们得到文件ProjectInstaller。我们可以看到两个,ServiceProcessInstall1和ServiceInstaller1。



点击F7,看看

In design mode. Right click --> Add Installer. We get the file ProjectInstaller. We can see two, ServiceProcessInstall1 and ServiceInstaller1.

Click F7 and see
[RunInstaller(true)]
    public partial class ProjectInstaller : System.Configuration.Install.Installer
    {
        public ProjectInstaller()
        {
            InitializeComponent();
        }
    }
}





右键单击InitializeComponent();选择转到定义(F12)你可以去





Right Click at InitializeComponent(); choose Go to Definition (F12) You can go to

/// </summary>
       private void InitializeComponent()
       {
           this.serviceProcessInstaller1 = new System.ServiceProcess.ServiceProcessInstaller();
           this.serviceInstaller1 = new System.ServiceProcess.ServiceInstaller();
           //
           // serviceProcessInstaller1
           //
           this.serviceProcessInstaller1.Password = null;
           this.serviceProcessInstaller1.Username = null;
           //
           // serviceInstaller1
           //
           this.serviceInstaller1.ServiceName = "Service1";
           //
           // ProjectInstaller
           //
           this.Installers.AddRange(new System.Configuration.Install.Installer[] {
           this.serviceProcessInstaller1,
           this.serviceInstaller1});

       }





并按上述方式更改。它的工作原理



and change it like above. It works


请试试这个:



Please try this:

this.serviceProcessInstaller1 = new System.ServiceProcess.ServiceProcessInstaller();
this.serviceInstaller1 = new System.ServiceProcess.ServiceInstaller();
//
// serviceProcessInstaller1
//
this.serviceProcessInstaller1.Account = System.ServiceProcess.ServiceAccount.LocalSystem;

this.serviceProcessInstaller1.Password = null;
this.serviceProcessInstaller1.Username = null;
//
// serviceInstaller1
//
this.serviceInstaller1.ServiceName = "TimerThreadService";
this.serviceInstaller1.StartType = System.ServiceProcess.ServiceStartMode.Automatic;


两件事

1)确保所有相关服务都已启动。

2)你有足够的可用内存。
Two things
1) Make sure any dependent services are started.
2) You have enough free memory.


这篇关于Windows无法在本地计算机上启动该服务。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆