Service no longer starts

J

JH

Hi, I'm writing a service that does some periodical logging, it was working
just fine, until this morning when it suddenly refused to start. While
testing I would compile the service, installed and then started the service,
ran the tests, stopped the service, uninstalled, changed whaterver was
needed and repeated the cycle, and this was working just fine. I have now
tried creating a couple of simple sevices from samples I found on the net
but they will also not start. I'm getting this message when trying to start
the service :

"Could not start the Service Name service on Local Computer. The service did
not return an error. This could be an internal Windows Error or an internal
service error, if the problem persists, contact your system administrator"

The service is set to run using the local account wich has administrative
rights. This is the full code of one of the samples:

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

namespace WindowsService
{
/// <summary>
/// This is the class for my Service
/// </summary>
public class MyService : System.ServiceProcess.ServiceBase
{
public MyService()
{
InitializeComponents();

// TODO: Add any further initialization code
}

private void InitializeComponents()
{
this.ServiceName = "MyService";
}

/// <summary>
/// This method starts the service.
/// </summary>
public static void Main()
{
System.ServiceProcess.ServiceBase.Run(new
System.ServiceProcess.ServiceBase[] {
new MyService() // To run more than one service you have to add them
here
});
}

/// <summary>
/// Clean up any resources being used.
/// </summary>
protected override void Dispose(bool disposing)
{
// TODO: Add cleanup code here (if required)
base.Dispose(disposing);
}

/// <summary>
/// Start this service.
/// </summary>
protected override void OnStart(string[] args)
{
// TODO: Add start code here (if required)
// to start your service.
EventLog.WriteEntry("Servicio Iniciado");
}

/// <summary>
/// Stop this service.
/// </summary>
protected override void OnStop()
{
// TODO: Add tear-down code here (if required)
// to stop your service.
EventLog.WriteEntry("Servicio Detenido");
}
}
}

[RunInstallerAttribute(true)]
public class ProjectInstaller : Installer
{
public ProjectInstaller()
{
ServiceProcessInstaller spi = new ServiceProcessInstaller();
spi.Account = ServiceAccount.LocalSystem;
ServiceInstaller si = new ServiceInstaller();
si.ServiceName = "Hello Service Template";
si.StartType = ServiceStartMode.Automatic;
Installers.AddRange(new Installer[] {spi, si});
}
}

using:
..Net Framework v1.1.4322
Windows 2000 Professional, up to date.
TIA
 
N

Nico Debeuckelaere

Do you see more info in the Event Log?

Regards,

--

Nico Debeuckelaere

ND-Sign BVBA (Microsoft Certified Partner since 2004)
URL: http://www.nd-sign.com
== ND-Sign, Designed for you ==
(This posting is provided "AS IS", with no warranties, and confers no
rights.)

JH said:
Hi, I'm writing a service that does some periodical logging, it was working
just fine, until this morning when it suddenly refused to start. While
testing I would compile the service, installed and then started the service,
ran the tests, stopped the service, uninstalled, changed whaterver was
needed and repeated the cycle, and this was working just fine. I have now
tried creating a couple of simple sevices from samples I found on the net
but they will also not start. I'm getting this message when trying to start
the service :

"Could not start the Service Name service on Local Computer. The service did
not return an error. This could be an internal Windows Error or an internal
service error, if the problem persists, contact your system administrator"

The service is set to run using the local account wich has administrative
rights. This is the full code of one of the samples:

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

namespace WindowsService
{
/// <summary>
/// This is the class for my Service
/// </summary>
public class MyService : System.ServiceProcess.ServiceBase
{
public MyService()
{
InitializeComponents();

// TODO: Add any further initialization code
}

private void InitializeComponents()
{
this.ServiceName = "MyService";
}

/// <summary>
/// This method starts the service.
/// </summary>
public static void Main()
{
System.ServiceProcess.ServiceBase.Run(new
System.ServiceProcess.ServiceBase[] {
new MyService() // To run more than one service you have to add them
here
});
}

/// <summary>
/// Clean up any resources being used.
/// </summary>
protected override void Dispose(bool disposing)
{
// TODO: Add cleanup code here (if required)
base.Dispose(disposing);
}

/// <summary>
/// Start this service.
/// </summary>
protected override void OnStart(string[] args)
{
// TODO: Add start code here (if required)
// to start your service.
EventLog.WriteEntry("Servicio Iniciado");
}

/// <summary>
/// Stop this service.
/// </summary>
protected override void OnStop()
{
// TODO: Add tear-down code here (if required)
// to stop your service.
EventLog.WriteEntry("Servicio Detenido");
}
}
}

[RunInstallerAttribute(true)]
public class ProjectInstaller : Installer
{
public ProjectInstaller()
{
ServiceProcessInstaller spi = new ServiceProcessInstaller();
spi.Account = ServiceAccount.LocalSystem;
ServiceInstaller si = new ServiceInstaller();
si.ServiceName = "Hello Service Template";
si.StartType = ServiceStartMode.Automatic;
Installers.AddRange(new Installer[] {spi, si});
}
}

using:
.Net Framework v1.1.4322
Windows 2000 Professional, up to date.
TIA
 
J

JH

There was nothing in the Event viewer, It ended up being the
EventLog.WeiteEntry() call that messed things up, removing it fixed the
problem, wish I knew why though.

Nico Debeuckelaere said:
Do you see more info in the Event Log?

Regards,

--

Nico Debeuckelaere

ND-Sign BVBA (Microsoft Certified Partner since 2004)
URL: http://www.nd-sign.com
== ND-Sign, Designed for you ==
(This posting is provided "AS IS", with no warranties, and confers no
rights.)

JH said:
Hi, I'm writing a service that does some periodical logging, it was working
just fine, until this morning when it suddenly refused to start. While
testing I would compile the service, installed and then started the service,
ran the tests, stopped the service, uninstalled, changed whaterver was
needed and repeated the cycle, and this was working just fine. I have now
tried creating a couple of simple sevices from samples I found on the net
but they will also not start. I'm getting this message when trying to start
the service :

"Could not start the Service Name service on Local Computer. The service did
not return an error. This could be an internal Windows Error or an internal
service error, if the problem persists, contact your system administrator"

The service is set to run using the local account wich has administrative
rights. This is the full code of one of the samples:

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

namespace WindowsService
{
/// <summary>
/// This is the class for my Service
/// </summary>
public class MyService : System.ServiceProcess.ServiceBase
{
public MyService()
{
InitializeComponents();

// TODO: Add any further initialization code
}

private void InitializeComponents()
{
this.ServiceName = "MyService";
}

/// <summary>
/// This method starts the service.
/// </summary>
public static void Main()
{
System.ServiceProcess.ServiceBase.Run(new
System.ServiceProcess.ServiceBase[] {
new MyService() // To run more than one service you have to add them
here
});
}

/// <summary>
/// Clean up any resources being used.
/// </summary>
protected override void Dispose(bool disposing)
{
// TODO: Add cleanup code here (if required)
base.Dispose(disposing);
}

/// <summary>
/// Start this service.
/// </summary>
protected override void OnStart(string[] args)
{
// TODO: Add start code here (if required)
// to start your service.
EventLog.WriteEntry("Servicio Iniciado");
}

/// <summary>
/// Stop this service.
/// </summary>
protected override void OnStop()
{
// TODO: Add tear-down code here (if required)
// to stop your service.
EventLog.WriteEntry("Servicio Detenido");
}
}
}

[RunInstallerAttribute(true)]
public class ProjectInstaller : Installer
{
public ProjectInstaller()
{
ServiceProcessInstaller spi = new ServiceProcessInstaller();
spi.Account = ServiceAccount.LocalSystem;
ServiceInstaller si = new ServiceInstaller();
si.ServiceName = "Hello Service Template";
si.StartType = ServiceStartMode.Automatic;
Installers.AddRange(new Installer[] {spi, si});
}
}

using:
.Net Framework v1.1.4322
Windows 2000 Professional, up to date.
TIA
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top