Can't connect to Sql Server in Windows service


New member
Apr 4, 2005
Programming Experience
I'm creating a windows service to monitor incoming faxes to our fax server. Designated folders will be looked at every minute (via the timer in the windows service), the name changed, and logged into a sql server database.

The windows service copies the files fine, but as soon as I try to connect to the sql server, the windows service says that there is an error when I try starting it up.

I've installed the service on an account that has admin privledges, as well as access to the database in sql server.

Any suggestions as to how to successfully connect to the database??

You have stated that you are using an admin account, is this a local (on the server with the service) or remote admin account?

IE: does the same username and password work as an admin on BOTH servers?

Is the SQL server using Integrated security?

What is the error you are getting? Are you sure that you actually getting TO the SQL server and being denied or is it possible there is an error in your connection info and you are not actually getting to the server?
If you can Elaborate the Question a Little would help , actually from where the error is raised.

If the Error is While starting the Windows Services , then there is a possiblity of Exception at the Start. use TRY ... CATCH blocks withing the startup code and create a log of Error to Trace the Exception.

While connecting to Database your Connection string might not be correct so it cannot cannot to Database..