从 WCF 服务访问 SharePoint 内容(列表)
我编写了一个 WCF 服务,它尝试从 SharePoint 中的特定列表中读取列表项。出于测试目的,我使用 Visual Studio ASP.Net 开发服务器运行 WCF 服务。我将站点 ID 传递给 Web 服务,并从 Web 服务尝试打开列表并读取项目。但是当我尝试阅读这些项目时,我收到以下错误 -
该操作只能执行 在连接到的计算机上 服务器场由拥有以下权限的用户组成 SQL Server 中的读取权限 配置数据库。连接 将此服务器连接到服务器场,使用 SharePoint 产品和 技术配置向导, 位于“开始”菜单中 管理工具。
以下是一些事实 -
- 我正在使用 SharePoint 2007 x64 Windows Server 2008 x64,它是 单服务器安装(无场)
- 我是场管理员
- 我是系统管理员(但不是 域管理员)
- 我是 SQL Server 的系统管理员 SharePoint 2005 服务器 正在拥有其数据库
- 我是网站集 列表所在的管理员 现在
- 我打开 Visual Studio 2010 adminsitrator
- 在任务管理器中,ASP.Net 开发服务器进程是 在我的帐户下运行
我不知道为什么会收到该错误。有什么想法吗?
I've written a WCF service which tries to read the list items from a particular list in SharePoint. For testing purposes I run the WCF service using Visual Studio ASP.Net Development server. I pass the Site ID to the web service and from the web service I try to open the List and read the items. But when I try to read the items I'm getting the following error -
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 and
Technologies Configuration Wizard,
located on the Start menu in
Administrative Tools.
Here are some facts -
- I'm using SharePoint 2007 x64 in
Windows Server 2008 x64 and it is a
single server installation (no farm) - I'm a Farm administrator
- I'm a System Administrator (but not
domain administrator) - I'm a SysAdmin for the SQL Server
2005 server in which is SharePoint
is having its databases - I'm the Site Collection
Administrator in which the List is
present - I opened Visual Studio 2010 as
adminsitrator - In task manager, the ASP.Net
development server process is
running under my account
I don't have any idea why I'm getting that error. Any ideas?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
WCF 服务是否在共享点计算机上运行?我敢打赌您正在尝试在共享点框之外使用 SharePoint 对象模型。
如果您想在自己的 WCF 服务中或实际上任何其他程序中远程访问共享点数据,则必须使用 Lists.asmx Web 服务从共享点检索数据。
事实上,在您的 WCF 中,您必须充当 SP 服务的客户端
[编辑]我的赌注是错误的:)这里还有另一件事需要检查
另外还要看看您的 VS 项目。将目标平台设置为“AnyCpu”或“X64”,以确保程序将使用正确的程序集和注册表项。
如果您的进程是 32 位,则对象模型将尝试打开
HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node
节点下的 reg 键,而不是共享点配置所在的HKEY_LOCAL_MACHINE\SOFTWARE
is the WCF service runnig on the sharepoint computer ? I bet you are trying to use the SharePoint object model outsite the sharepoint box.
If you want to access remotely to the sharepoint data, in a WCF service on your own, or actually any other program, you will have to use the Lists.asmx web service to retrieve your data from sharepoint.
In fact, in your WCF you will have to act as a client to the SP services
[edit] my bet was wrong :) here is another thing to check
Also take a look in your VS project. Setup your target platform to "AnyCpu" or "X64" to ensure the program will use the correct assemblies and registry keys.
The object model will try to open the reg key under
HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node
node if you process is 32 bits, instead ofHKEY_LOCAL_MACHINE\SOFTWARE
where the sharepoint config resides尝试检查您的共享点应用程序池身份。例如,如果您尝试在服务中使用 RunWithEvelatedPrivilegies 来提升权限,并且应用程序池标识没有所需的权限,您将收到此类消息。
Try to check your sharepoint application pool identity. If you, for example, trying to evelate you priviligies using RunWithEvelatedPrivilegies in your service, and app pool identity doesn't have required permissions, you will get such message.
好吧。我发现了这个问题。这与我在 SharePoint 2007 中切换到 x64 开发后一直面临的相同问题有关。当我将 WCF 服务部署到 IIS 时,一切工作正常。
使用 Visual Studio 2010(无论怎样)我的项目的目标平台是)我从未能够通过简单的控制台应用程序或简单的 asp.net Web 应用程序访问 SharePoint 内容。我清楚地知道问题出在 x86 x64 上,但到目前为止我还无法解决它。我已经被这个问题困扰了很长时间了。
如果您对此答案有任何意见,请发表。
旧参考 - 打开 SPSite 对象时出现 Filenotfound 异常 - x64
Okie. I found the issue. It is related to the same problem which I've been facing since I switched to x64 development in SharePoint 2007. When I deployed the WCF service to IIS everything worked fine.
Using Visual Studio 2010 (no matter what my target platform of my project is) I've never been able to access SharePoint content through a simple console application or a simple asp.net web application. I've clearly understood that the problem is with the x86 x64 stuffs and I've not been able to resolve it till now. I've been haunted by this for so long now.
If you have any comments on this answer please post it.
Old Ref - Filenotfound exception while opening an SPSite object - x64