Click here to Skip to main content
15,891,749 members
Please Sign up or sign in to vote.
1.50/5 (2 votes)
See more:
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[^]
Posted
Comments
Sergey Alexandrovich Kryukov 23-Aug-13 0:52am    
There can be too many ways to screw up things. How can we know how you did it?
—SA
Bernhard Hiller 23-Aug-13 3:13am    
And what does event viewer tell you about the failure? Any further details about the error? Do you use some logging? And what can see in the log files?

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

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


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

C#
/// </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
 
Share this answer
 
Comments
shacha 24-Aug-13 0:11am    
I have changed the code but still the same error.
Anh Nguyen Trong 25-Aug-13 0:39am    
What is os? Win 7?
Please try this:

C#
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;
 
Share this answer
 
Comments
shacha 23-Aug-13 3:27am    
Where should i write this??
bbirajdar 23-Aug-13 4:44am    
Yes. The service should either run on the Local Syatem account or as Network Service provided the network credentials are available
Two things
1) Make sure any dependent services are started.
2) You have enough free memory.
 
Share this answer
 
Comments
shacha 23-Aug-13 3:27am    
There are no dependent services and i have tried this example using this link
http://msdn.microsoft.com/en-us/library/ff649818.aspx

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month


CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900