问题
I am considering creating a windows service that would run periodically and query networked databases and store the information on the local machine (please don’t ask why!). I would like this service to run when there is no one logged on to the computer locally. What account should the service run under Localservice, Localsystem or Network. A username and password would be provided to all networked databases including the local.
回答1:
I'd probably create a specific domain account and grant that rights to both SQL server and whatever local store you are going to use. If you want to use SQL credentials to connect to the DB, then it could be a local account (with access to the local resources) or a higher privileged user (like LocalSystem).
回答2:
To guarantee that you can actually connect to the databases, I would suggest that you create a services account (something like /User - and apply a password that doesn't expire).
This way you can set up the user in SQL Server and use integrated security while connecting.
For example:
Domain: stackoverflow Service: SearchDB
I would create a user stackoverflow\SearchDBUser
Basically you don't have to stick to the pre-defined users when setting up the windows service.
I hope this helps.
Wagner.
回答3:
This might actually be better asked on ServerFault, but I've always seen it as 'Network' or 'Local System' depending on specific usage.
来源:https://stackoverflow.com/questions/3338773/what-windows-account-should-a-service-run-under-to-access-network-sql-servers