Problems Starting a VB windows Service

  • Thread starter Shane Lowenberger via .NET 247
  • Start date
S

Shane Lowenberger via .NET 247

Hi All,

I created a Windows Service in Visual Basic.NET and am having troubles. My Service installs fine, but when I start I get two exceptions thrown in the Event Log and the service stops. Here they are:

1: System.IndexOutOfRangeException: Index was outside the bounds of the array.
at ServiceName.OnStart(String[] args)

This one happens before the service starts, then I get

2. Service cannot be started. System.InvalidCastException: Specified cast is not valid.
at ServiceName.OnStart(String[] args)
at System.ServiceProcess.ServiceBase.ServiceQueuedMainCallback(Object state)

Any ideas, I'm beating my head against the wall.

Thanks in advance,
 
S

Sameh Ahmed

Dear Shane
regarding the first problem I believe this is not related to the fact that
this is a service.
this seems like trying to access an array outside it's boundaries.
Example
dim arr(30)
arr(40) = 3
this would give the same error.
Regards
Sameh


Shane Lowenberger via .NET 247 said:
Hi All,

I created a Windows Service in Visual Basic.NET and am having troubles.
My Service installs fine, but when I start I get two exceptions thrown in
the Event Log and the service stops. Here they are:
1: System.IndexOutOfRangeException: Index was outside the bounds of the array.
at ServiceName.OnStart(String[] args)

This one happens before the service starts, then I get

2. Service cannot be started. System.InvalidCastException: Specified cast is not valid.
at ServiceName.OnStart(String[] args)
at System.ServiceProcess.ServiceBase.ServiceQueuedMainCallback(Object state)

Any ideas, I'm beating my head against the wall.

Thanks in advance,
 

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