我有一个数据库“Sample”。 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”具有对“Sample”数据库的“db_owner”访问权限。我对么 ?我哪里不见了?
谢谢
最佳答案
由于您在连接字符串中指定了集成安全性
,因此在使用 Windows 身份验证时不应指定用户名和密码。
相反,您将使用运行 ASP.NET 的任何域帐户(可能是网络服务帐户)进行身份验证。
您的应用程序可能以与 CORPHQ\King
完全不同的用户身份进行连接,并且此其他登录名没有执行此操作的权限。
更多详情,请参阅 How To: Connect to SQL Server Using Windows Authentication in ASP.NET 2.0
关于asp.net - 对对象 '<Table_Name>'、数据库 '<Database_Name>'、架构 'dbo' 的 SELECT 权限被拒绝。 - ASP.NET/SQL 服务器,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13829709/