c# - 从分层对象存储读取/写入到分层对象存储 - SharePoint 2007

标签 c# sharepoint sharepoint-2007 wss-3.0 sharepoint-timer-job

我创建了一个自定义计时器作业,需要一些配置才能运行。我正在尝试将配置保存为分层对象存储中的 SPPersistedObject

分层对象存储保存在 SharePoint 配置数据库中,因此我在尝试使用 SPWebApplication 作为父级保存它时收到“安全错误”。

我什至尝试过提升权限,但它没有帮助,因为它只是当前 Web 应用程序的应用程序池帐户,不需要访问 SharePoint 配置数据库。

有什么想法吗?

最佳答案

正如您所发现的,分层对象存储 (HOS) 存储在配置数据库中,而不是内容数据库中。

如果您在中央管理员以外的站点上下文中运行,则应用程序池使用的用户帐户 may not have permissions to Write to the configuration database

这有点奇怪,因为您可能不会在开发人员安装中看到这一点(因为您可能不会使用应用程序池的域级别帐户进行设置,只有网络服务),并且您只会出错当您投入生产时。

注意 - 使用 SPSecurity.RunWithElevatedPrivileges 不会更改此设置,因为它只是从受限用户帐户提升到应用程序池帐户,而不是中央管理应用程序池帐户。

文章Managing Application State给出了选项的详细信息,并说明了居屋的情况

Security model - Users need administrator privileges to access the related SharePoint object (such as SPFarm or SPWebApplication).

出于这些原因我认为居屋在现实世界中的使用非常有限,您最好使用属性包存储模型,它可以存储农场/Web应用程序/站点和列表级别的设置:-

Advantages - It is probably the most light-weight and easy to use of all the configuration storage options.

还有报道performance and stability benefits .

事实上MSDN SharePoint Guidance Library还使用属性包存储来实现分层配置管理器

关于c# - 从分层对象存储读取/写入到分层对象存储 - SharePoint 2007,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4561976/

相关文章:

sharepoint - 部署依赖于数据库存储的 Web 部件

c# - 如何反转 foreach 中的列表?

c# - 在 Visual Studio 2013 中创建应用程序设置

c# - System.Drawing Out of Memory Exception on Main() 方法 - C#

sharepoint - 如何在sharepoint中创建触发器?

c# - 使用 LINQ 选择具有不同列值的行

sharepoint - 重新设计 SharePoint 网站的最佳实践

c# - ASP.NET MVC Dotfuscator 问题

javascript - 在 sharepoint javascript 模型的每个循环中同步执行QueryAsync

sharepoint-2007 - 如何升级 SharePoint 解决方案?