5

我有一个数据库“样本”。Active Directory (AD) 中有一个名为“CORPHQ\King”的用户。我已按照以下步骤操作:

1) Go to SQL Server Management Studio (2005) and "Security -> Logins".
2) Right Click -> New Login
3) Login Name : CORPHQ\King
4) Selected "Windows Authentication"
5) Default database - "Sample".
6) Under "User Mapping" section, Selected the "Sample" database, User as "CORPHQ\King" and selected "dbo" as default schema.
7) Selected "db_owner" as "Database role membership for - Sample".

现在在 ASP.NET 应用程序的 WEB.CONFIG 中,我确实有:

<connectionStrings>
    <add name="DB" connectionString="Data Source=128.127.126.25; database=Sample; user=corphq\King; password=XXXXXXXXXXX; Integrated Security=SSPI;" providerName="System.Data.SqlClient"/>
</connectionStrings>

现在,当我运行 ASP.NET 应用程序时,我收到了提到的错误:

Error:

The SELECT permission was denied on the object 'tbl_Student', database 'Sample', schema 'dbo'

我认为用户“CORPHQ\King”拥有“db_owner”对“Sample”数据库的访问权限。我对么 ?我在哪里失踪?

谢谢

4

3 回答 3

4

由于您Integrated Security在连接字符串中指定,因此在使用 Windows 身份验证时不应指定用户名和密码。

相反,您将使用运行 ASP.NET 的任何域帐户进行身份验证,这可能是网络服务帐户。

您的应用程序可能以与 完全不同的用户身份连接CORPHQ\King,并且此其他登录没有此操作的权限。

有关更多详细信息,请参阅如何:在 ASP.NET 2.0 中使用 Windows 身份验证连接到 SQL Server

于 2012-12-11T22:48:44.820 回答
2

您可能已授予它连接数据库的权限,但应该有进一步的步骤来授予用户特定权限,例如对该数据库中的表的 SELECT、INSERT、UPDATE 和 DELETE。

于 2012-12-11T22:46:32.597 回答
1

解决这个问题的方法是打开 dbo 模式转到属性并单击查看数据库权限链接。授予数据库选择,删除 DOMAIN\MACHINENAME$ 的编辑权限。用户。

于 2014-05-12T05:25:43.720 回答