Problem With Starting Windows 2000 Service Developed in VB.Net

G

Guest

I'm having a strange problem with a service I developed. After installing the service on the target machine, I'm trying to start it using the Services admin window. I get the "Windows is starting" status window, but it times out - even though the application's log file says that it did start. The service's OnStart event spawns a thread and exits - that's all! I even tried it with no code in the OnStart event and get the same thing. The service is actually executing and doing everything I expect it to, but its status stays at Starting.

The other weird thing is that it doesn't happen on all machines. We have multiple development machines, and it works fine when I install it on them, but it doesn't work on my development machine or the production machine.

Has anyone run across this???

Thanks!
 
J

Jeremy Cowles

hogcods said:
I'm having a strange problem with a service I developed. After installing
the service on the target machine, I'm trying to start it using the Services
admin window. I get the "Windows is starting" status window, but it times
out - even though the application's log file says that it did start. The
service's OnStart event spawns a thread and exits - that's all! I even tried
it with no code in the OnStart event and get the same thing. The service is
actually executing and doing everything I expect it to, but its status stays
at Starting.
The other weird thing is that it doesn't happen on all machines. We have
multiple development machines, and it works fine when I install it on them,
but it doesn't work on my development machine or the production machine.
Has anyone run across this???


I have done some work with services, but I have not seen this. What happens
if you compile it as a standard Executable? Will it run on all machines? Is
there anything in common on the machines that will run it vs. the machines
that won't run it?

Have you tried creating an entirly new service, with a different name and no
code? In other words, will any .NET services run?

~
Jeremy
 
M

Mike Bulava

Post the Service Class code I've had this happen to me before, it not always
an easy thing to find.


hogcods said:
I'm having a strange problem with a service I developed. After installing
the service on the target machine, I'm trying to start it using the Services
admin window. I get the "Windows is starting" status window, but it times
out - even though the application's log file says that it did start. The
service's OnStart event spawns a thread and exits - that's all! I even tried
it with no code in the OnStart event and get the same thing. The service is
actually executing and doing everything I expect it to, but its status stays
at Starting.
The other weird thing is that it doesn't happen on all machines. We have
multiple development machines, and it works fine when I install it on them,
but it doesn't work on my development machine or the production machine.
 
G

Guest

Yes, I created a new service class and didn't add any code - same thing.

----- Jeremy Cowles wrote: -----

I have done some work with services, but I have not seen this. What happens
if you compile it as a standard Executable? Will it run on all machines? Is
there anything in common on the machines that will run it vs. the machines
that won't run it?

Have you tried creating an entirly new service, with a different name and no
code? In other words, will any .NET services run?

~
Jeremy
 
G

Guest

Here's the service class code for the test service I set up that has no additional code

Imports System.ServiceProces

Public Class Service
Inherits System.ServiceProcess.ServiceBas

#Region " Component Designer generated code

Public Sub New(
MyBase.New(

' This call is required by the Component Designer
InitializeComponent(

' Add any initialization after the InitializeComponent() cal

End Su

'UserService overrides dispose to clean up the component list
Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean
If disposing The
If Not (components Is Nothing) The
components.Dispose(
End I
End I
MyBase.Dispose(disposing
End Su

' The main entry point for the proces
<MTAThread()>
Shared Sub Main(
Dim ServicesToRun() As System.ServiceProcess.ServiceBas

' More than one NT Service may run within the same process. To ad
' another service to this process, change the following line t
' create a second service object. For example

' ServicesToRun = New System.ServiceProcess.ServiceBase () {New Service1, New MySecondUserService

ServicesToRun = New System.ServiceProcess.ServiceBase () {New Service1

System.ServiceProcess.ServiceBase.Run(ServicesToRun
End Su

'Required by the Component Designe
Private components As System.ComponentModel.IContaine

' NOTE: The following procedure is required by the Component Designe
' It can be modified using the Component Designer.
' Do not modify it using the code editor
<System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent(
components = New System.ComponentModel.Container(
Me.ServiceName = "Service1
End Su

#End Regio

Protected Overrides Sub OnStart(ByVal args() As String
' Add code here to start your service. This method should set thing
' in motion so your service can do its work
End Su

Protected Overrides Sub OnStop(
' Add code here to perform any tear-down necessary to stop your service
End Su

End Clas

And here's the Project Installer code

Imports System.ComponentMode
Imports System.Configuration.Instal

<RunInstaller(True)> Public Class ProjectInstalle
Inherits System.Configuration.Install.Installe

#Region " Component Designer generated code

Public Sub New(
MyBase.New(

'This call is required by the Component Designer
InitializeComponent(

'Add any initialization after the InitializeComponent() cal

End Su

'Installer overrides dispose to clean up the component list
Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean
If disposing The
If Not (components Is Nothing) The
components.Dispose(
End I
End I
MyBase.Dispose(disposing
End Su

'Required by the Component Designe
Private components As System.ComponentModel.IContaine

'NOTE: The following procedure is required by the Component Designe
'It can be modified using the Component Designer.
'Do not modify it using the code editor
Friend WithEvents ServiceProcessInstaller1 As System.ServiceProcess.ServiceProcessInstalle
Friend WithEvents ServiceInstaller1 As System.ServiceProcess.ServiceInstalle
<System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent(
Me.ServiceProcessInstaller1 = New System.ServiceProcess.ServiceProcessInstaller(
Me.ServiceInstaller1 = New System.ServiceProcess.ServiceInstaller(

'ServiceProcessInstaller

Me.ServiceProcessInstaller1.Password = Nothin
Me.ServiceProcessInstaller1.Username = Nothin

'ServiceInstaller

Me.ServiceInstaller1.ServiceName = "TestService

'ProjectInstalle

Me.Installers.AddRange(New System.Configuration.Install.Installer() {Me.ServiceProcessInstaller1, Me.ServiceInstaller1}

End Sub

#End Region

End Class
 

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