简体   繁体   English

SharePoint自定义Web部件对对象'xxx',数据库'yyy',所有者'dbo'抛出SELECT权限被拒绝

[英]SharePoint Custom Web Part throws SELECT permission denied on object 'xxx', database 'yyy', owner 'dbo'

I have created a Custom Web Part in SharePoint 2007 using VS 2008 on the dev server. 我已经在开发服务器上使用VS 2008在SharePoint 2007中创建了自定义Web部件。 It uses the SQL DB. 它使用SQL DB。 Everything works fine on my server with testing db which I recreated from the backup client gave me. 我通过备份客户端重新创建的测试数据库在服务器上运行正常。

Now I'm moving it over to the clients' production server. 现在,我将其移至客户端的生产服务器。 I was able to deploy, install and activate it. 我能够部署,安装和激活它。

But when I'm trying to add the web part to the page, it throws a dialogbox with "An error occured while executing the command definition. See the inner exception for details". 但是,当我尝试将Web部件添加到页面时,它将引发一个对话框,显示“执行命令定义时发生错误。有关详细信息,请参见内部异常”。

This is what I see in the LOG file: ... SELECT permission denied on object 'xxx', database 'yyy', owner 'dbo' ... 这是我在LOG文件中看到的内容: ...对对象'xxx',数据库'yyy',所有者'dbo'的SELECT权限被拒绝...

The Web Part accesses the DB using the escalated priveleges, ie using the portal app pool service account. Web部件使用升级的特权(即,使用门户网站应用程序池服务帐户)访问数据库。 This account has proper rights to access the DB. 该帐户具有访问数据库的适当权限。 I don't understand what can cause the problem. 我不明白是什么原因引起的。

Any help figuring out what causes the error is greatly appreciated! 非常感谢您找出导致错误的原因的任何帮助!

EDIT: 编辑:

Code pasted in comment included here to add formatting: 粘贴在注释中的代码包含在此处以添加格式:

SPSecurity.RunWithElevatedPrivileges(delegate() 
{ 
    using (WAStockBinEntities context = new WAStockBinEntities()) 
    { 
        var userStockBin = (from stockBins in context.T1view_SP_StockBin 
                            where stockBins.ADName == currUserName 
                            select stockBins) .ToList().FirstOrDefault(); 

        StockRoomNumber.Text = userStockBin.Stockroom; 
        BinNumber.Text = userStockBin.BIN; 
    } 
});

SPSecurity.RunWithElevatedPrivileges does not affect the user that LINQ uses to access the database. SPSecurity.RunWithElevatedPrivileges不会影响LINQ用于访问数据库的用户。 I would look at the connection string that LINQ is using to access the database and ensure that the user referenced in the connection string has permissions to the database 我将查看LINQ用于访问数据库的连接字符串,并确保在连接字符串中引用的用户具有对数据库的权限

You can check the connection string that is being used by calling the Connection.ConnectionString property of the data context. 您可以通过调用数据上下文的Connection.ConnectionString属性来检查正在使用的连接字符串。

using (WAStockBinEntities context = new WAStockBinEntities()) 
{ 
    return context.Connection.ConnectionString;
}

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 SELECT对象&#39;Notes&#39;,数据库&#39;Sticky&#39;,schema&#39;dbo&#39;被拒绝 - The SELECT permission was denied on the object 'Notes', database 'Sticky', schema 'dbo' 对对象``数据库&#39;&#39;模式&#39;dbo&#39;的SELECT权限被拒绝。 使用DBML - The SELECT permission was denied on the object '', database '', schema 'dbo'. using DBML 内部异常(1):对对象“ proc_putObject”,数据库“ SharePoint_Config”,架构“ dbo”的EXECUTE权限被拒绝 - Inner exception(1): The EXECUTE permission was denied on the object 'proc_putObject', database 'SharePoint_Config', schema 'dbo' 对象&#39;地址&#39;,数据库&#39;CNET_85731&#39;,架构&#39;dbo&#39;上的SELECT权限被拒绝 - The SELECT permission was denied on the object 'Address', database 'CNET_85731', schema 'dbo' Sharepoint自定义Web部件 - Sharepoint custom Web Part 未捕获的TypeError:对象# <YYY> 没有方法“ xxx” - Uncaught TypeError: Object #<YYY> has no method 'xxx' MySql.Data.MySqlClient.MySqlException (0x80004005):SELECT 命令拒绝用户 'XXX'@'YYY' 用于表 'bogus_table' - MySql.Data.MySqlClient.MySqlException (0x80004005): SELECT command denied to user 'XXX'@'YYY' for table 'bogus_table' 拒绝访问路径“ Global \\ {xxx} _YYY-YYY:13552”。 迟发型? - Access to the path 'Global\{xxx}_YYY-YYY:13552' is denied. Hangfire? 在SharePoint Web部件共享设置中多选? - Multi select in SharePoint Web Part Shared Settings? 自定义可视化 Web 部件属性 sharepoint - Custom visual web part properties sharepoint
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM