MOSS 2010 - SPWebApplication.Lookup 函数错误
我正在尝试执行以下代码:
SPSecurity.RunWithElevatedPrivileges(delegate()
{
HttpContext.Current.Items["FormDigestValidated"] = true;
SPWebApplication webApp = SPWebApplication.Lookup(new Uri(string.Format("http://{0}", swebapplicationurl)));
SPSiteCollection sites = webApp.Sites;
Site.Dispose();
});
它最终出现错误,如下所示:
“ 此操作只能在由具有 SQL Server 读取配置数据库权限的用户加入服务器场的计算机上执行。要将此服务器连接到服务器场,请使用 SharePoint 产品配置向导(位于 Microsoft SharePoint 2010 产品的“开始”菜单上)。 “
我被困住了。请帮忙。
谢谢,
I am trying to execute the following code:
SPSecurity.RunWithElevatedPrivileges(delegate()
{
HttpContext.Current.Items["FormDigestValidated"] = true;
SPWebApplication webApp = SPWebApplication.Lookup(new Uri(string.Format("http://{0}", swebapplicationurl)));
SPSiteCollection sites = webApp.Sites;
Site.Dispose();
});
It ends up with error as follows:
"
This operation can be performed only on a computer that is joined to a server farm by users who have permissions in SQL Server to read from the configuration database. To connect this server to the server farm, use the SharePoint Products Configuration Wizard, located on the Start menu in Microsoft SharePoint 2010 Products.
"
I am stuck. Please help.
Thanks,
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我可以通过执行以下操作来解决此问题:
创建应用程序池
选择高级设置
设置 .Net Framework 版本 [设置v2.0 对我有用]
在流程模型下---> Identity
提供自定义帐户。提供用户名和对 SQL Server 中的 SharePoint 配置数据库具有权限的用户的密码。
将“加载用户配置文件”设置为“真”。
重置 IIS,清除现金。
会起作用的
I am able to resolve this issue by doing the following:
Create an Application Pool
Select Advance settings
Set .Net Framework version [setting v2.0 worked for me]
Under Process Model ---> Identity
Provide Custom account. provide the username & password of the user who has the premissions on SharePoint Config database in the SQL Server.
Set Load User Profile to TRUE.
Reset IIS, Clear cashe.
It will work