469,647 Members | 1,814 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,647 developers. It's quick & easy.

Problem With Starting Windows 2000 Service Developed in VB.Net

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!
Nov 20 '05 #1
4 1250
"hogcods" <an*******@discussions.microsoft.com> wrote in message
news:49**********************************@microsof t.com...
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

Nov 20 '05 #2
Post the Service Class code I've had this happen to me before, it not always
an easy thing to find.
"hogcods" <an*******@discussions.microsoft.com> wrote in message
news:49**********************************@microsof t.com...
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!

Nov 20 '05 #3
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
Nov 20 '05 #4
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(ServicesToRu n
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

Nov 20 '05 #5

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

2 posts views Thread by DaveF | last post: by
17 posts views Thread by Danieltbt05 | last post: by
1 post views Thread by Mahesh Devjibhai Dhola | last post: by
reply views Thread by =?Utf-8?B?U2ltb25EZXY=?= | last post: by
reply views Thread by gheharukoh7 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.