views:

277

answers:

4

I've installed a vb.net windows service on a Windows 2008 machine, that is attempting to connect to SQL 2005. The service starts succesfully, but can't see the database. The event log has the following entry.

The description for Event ID 0 from source SU4.ESMR.DAL.Job.FillPriorityJobByType(oJobDS, TypeID: 3 cannot be found. Either the component that raises this event is not installed on your local computer or the installation is corrupted. You can install or repair the component on the local computer.

This was tested locally on both XP and 2008. All environments are 32 bit.

A: 

There isn't much to go on here, but it sounds to me like the service account doesn't have the required access rights to the database.

If you installed the service to run under Network Service or Local, create an account on the server that has access to the database and change it to use that service.

rjrapson
A: 

This sounds like a security issue to me. I would check the permissions on the account the service is using to connect to sql.

Scott
A: 

There will probably be an unhandled managed exception associated with this event. If details about that exception don't appear in the event log, you can create a last-chance filter that intercepts any unhandled exception and then logs it wherever you wish.

To do this, first add this line early in your service start-up code:

AddHandler Application.ThreadException, AddressOf LogException

Then create the logging procedure:

Private Sub LogException(ByVal sender As Object, _
                         ByVal e As System.Threading.ThreadExceptionEventArgs)
    'This method will be called by any unhandled managed exception, assuming 
    'that a debugger isn’t attached. You should log the exception here.
End Sub
RoadWarrior
A: 

Your windows service by default runs under the local system account, you can see this by looking at the "Log On" tab for your service in the Services MMC snapin. The chances are that this account doesn't have permissions for your database.

You can either have the service run under a different account (you might want to try running the service as yourself to see if that fixes the problems), but you should then change the permissions on the local system account to give them access.

Kragen