[英]Where Store SQL Server credentials on Windows Client to Access SQL Server
I have a Windows service running under a local system account on all company clients. 我在所有公司客户端上的本地系统帐户下运行Windows服务。 But my service needs to access SQL Server 2008 R2 which is on a central SQL Server instance.
但我的服务需要访问位于中央SQL Server实例上的SQL Server 2008 R2。
My problem is how to securely store the login credentials for the SQL Server connection and access them with C#. 我的问题是如何安全地存储SQL Server连接的登录凭据并使用C#访问它们。 Or is there another opportunity to connect to SQL Server?
或者是否有另一个连接到SQL Server的机会?
What are best practices for such a scenario? 这种情况的最佳做法是什么?
The best approach would be to run the Windows Service under a dedicated domain account. 最好的方法是在专用域帐户下运行Windows服务。 This way username and password would not need to be stored on the local computer at all.
这样,用户名和密码根本不需要存储在本地计算机上。 You could use integrated security instead and grant SQL Server access to that domain account.
您可以使用集成安全性,并授予SQL Server对该域帐户的访问权限。
If that's not an option for you, you will need to encrypt the sensitive data in your configuration file. 如果这不适合您,则需要加密配置文件中的敏感数据。 You might want to take a look at
SectionInformation.ProtectSection
method. 您可能想看看
SectionInformation.ProtectSection
方法。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.