具有特定AD帐户凭据的ConnectionString [英] ConnectionString with spectific AD account credential

查看:89
本文介绍了具有特定AD帐户凭据的ConnectionString的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我托管以特定AD用户帐户运行的Windows服务。该用户在我的MS SQL数据库中没有权限。取而代之的是,我有另一个在数据库中拥有权限但无法运行Windows服务的AD用户帐户。

I host a windows service running under a specific AD user account. This user has no right in my MS SQL database. Instead of that, I have another AD user account that has rights in my database, but can't run a windows service.

这是我的以下连接字符串:

Here is my following connection string :

<connectionStrings>
    <add name="CnxDev" connectionString="Server=FOOOOO1111\DEV2008R2;Database=Fooo;Trusted_Connection=True;"
      providerName="System.Data.SqlClient" />
</connectionStrings>

如何指定特定的AD用户凭据来使用我的SQL请求?
当然,我已经在Internet上查找任何信息,但是与Windows服务和AD帐户中的AD帐户无关。

How can I specify specific AD user credential to consume my SQL requests ? Of course I already check on the internet to find any information, but nothing related to windows service and AD account in an AD account.

推荐答案

我会考虑设置一个托管服务帐户,该帐户具有运行服务所需的访问权限以及SQL中的适当权限。如果您不想这样做(或不能这样做),则可以通过模拟来做到这一点。这是使用c#

I would consider setting up a managed service account that has the access you need to both run the service and proper permissions in SQL. If you do not want to do this (or cant), you can do this with impersonation. Here is an example using c#

> https://platinumdogs.me/2008/10/30/net-c-impersonation-with-network-credentials/

这篇关于具有特定AD帐户凭据的ConnectionString的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆