Wednesday, February 18, 2009

Accessing SQL Server (2005+) databases in .NET Windows services

just a simple quickie here. i completed my application (somewhat...do we ever really complete applications?) - and the service it was meant to configure — then found out that while it ran beautifully in console mode, it just sat there after connecting to the SMPP server. i kept wondering what the problem was. much later i realized that the service was created to run using the local Service account, which is a low-privileged account. as such, it cannot connect using Windows authentication to SQL Server versions that support it. in reality, this is the second time i've faced this issue. at any rate, all i needed to do was change the service to run under the local System account (a highly privileged account) and the problem was solved. another solution would probably be to use SQL Server authentication, which Microsoft doesn't recommend. yet running a service using the local system account is also seen as a bad idea. i guess you'll need to make a tradeoff to solve this problem.

by the way, this is the app i was complaining about. . many thanks to Component Factory for the excellent (and free) Krypton Toolkit.

No comments: