C# 发生 SharePoint 未知 SPRequest 错误。更多信息:0x80070005
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/2326305/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
SharePoint Unknown SPRequest error occurred. More information: 0x80070005
提问by Smur
Oh SharePoint...
哦,SharePoint...
I've built a custom event receiver that just checks for some fields from the list, and changes some of them as needed.
我构建了一个自定义事件接收器,它只检查列表中的某些字段,并根据需要更改其中的一些字段。
Still, it's throwing this exception:
尽管如此,它还是抛出了这个异常:
Unknown SPRequest error occurred. More information: 0x80070005 ERROR: Failed invoking job id {C67EFFCB-607A-4B6A-8C90-60F615FD1878}
发生未知的 SPRequest 错误。更多信息:0x80070005 错误:无法调用作业 ID {C67EFFCB-607A-4B6A-8C90-60F615FD1878}
Seen that it might be a security issue, and, in another stackoverflow topic I've seen that it may even be because im using the following code:
看到这可能是一个安全问题,并且,在另一个 stackoverflow 主题中,我看到它甚至可能是因为我使用了以下代码:
SPSecurity.RunWithElevatedPrivileges(delegate()
{
using (SPSite site = new SPSite(siteId))
{
this.DisableEventFiring();
// Logic code.
// ...
}
});
But removing it will need a recompile, and redeploy. Thought it would be better asking to have sure first.
但是删除它需要重新编译和重新部署。认为最好先确定一下。
In the production environment, we have two servers, one for the sites, and one for the database. Active directory is also implemented and fully functional. And for what I've checked, all accounts have the "create subsite" permission on Central Administration, as seen in another topic.
在生产环境中,我们有两台服务器,一台用于站点,一台用于数据库。活动目录也已实施且功能齐全。对于我检查过的内容,所有帐户都具有管理中心的“创建子站点”权限,如另一个主题中所示。
So any ideas?
那么有什么想法吗?
Thanks in advance.
提前致谢。
采纳答案by Smur
Problem solved.
问题解决了。
After writing logs and exceptions to txt files, and being mislead by the sharepoint log, What was really happening was that a column name was wrong in my code. Since this is a very specific customization, it had some column names literally wrote to the code. One of them had '_' around it, like _Column_
IN THE LIST, IN SHAREPOINT.
在将日志和异常写入 txt 文件并被共享点日志误导后,真正发生的是我的代码中的列名错误。由于这是一个非常具体的定制,它有一些列名字面写到代码中。其中一个在它周围有“_”,例如_Column_
在列表中,在共享点中。
But as it goes to SQL, it didn't have the '_'s.
但是对于 SQL,它没有“_”。
Looking back it appears that someone created the list and then renamed it. So when you create a list, it registers in SQL the FIRST name of the column. If you change it, it wont be changed on SQL, it will be changed in the list, in SharePoint, but the column name in SQL will still have its original name...
回过头来看,似乎有人创建了该列表,然后对其进行了重命名。因此,当您创建列表时,它会在 SQL 中注册列的 FIRST 名称。如果你改变它,它不会在SQL上改变,它会在列表中改变,在SharePoint中改变,但SQL中的列名仍然是它的原始名称......
If you already knew that congrats, because that was such a finding for me...
如果你已经知道那恭喜你,因为这对我来说真是一个发现......
回答by Janis Veinbergs
What about trying to use
尝试使用怎么样
this.DisableEventFiring();
try
{
using (SPSite site = new SPSite(siteId, properties.Site.SystemAccount.UserToken) {
}
}
finally
{
this.EnableEventFiring();
}
Ofcourse you can't without RunWithElevatedPrivileges if you want to modify some files on filesystem there, but otherwise it may help.
当然,如果你想修改文件系统上的一些文件,你不能没有 RunWithElevatedPrivileges,否则它可能会有所帮助。