c# - SharePoint 2013 : SPLongOperation timing out

标签 c# sharepoint timeout sharepoint-2013

目前,我在 SharePoint 2013 中遇到 SPLongOperation 问题。我有一些自定义逻辑,至少需要 15 分钟才能处理,因此我使用 SPLongOperation 来确保它不会在 6 分钟后超时。过去这段代码可以在 SharePoint 2010 上运行。问题是代码执行在 6 分钟后恰好停止。连接调试器后,它不会超时,因此 SPLongOperation block 会被忽略或无法正常工作。我用来调用 SPLongOperation 的代码如下:

using (SPLongOperation operation = new SPLongOperation(Page))
{
    try
    { 
        operation.LeadingHTML = html; //adding some custom html...
        operation.Begin();

        // Business Logic
    }
    finally
    {
        operation.End("/page.aspx", SPRedirectFlags.RelativeToLayoutsPage, Context, string.Empty);
    }
}

我在使用这段代码的几台机器上看到的行为是,6 分钟后发生超时,ULS 中出现以下异常: System.Web.HttpException:请求超时。有谁知道可能是什么问题?我正在使用安装了 October CU 的 SharePoint 2013。我还使用 while(true) 语句测试了此 block ,以确保业务逻辑不会导致问题。

最佳答案

也有这个问题,找到了这个办法,在创建SPLongOp对象之前定义页面的超时时间:

Page.Server.ScriptTimeout = 3600; // specify the timeout to 3600 seconds
 using (SPLongOperation operation = new SPLongOperation ( this .page))
 {
 }

来源:http://shaharpan.wordpress.com/2014/11/20/splongoperation-thread-was-being-aborted-error-in-sharepoint-2013/

托马斯

关于c# - SharePoint 2013 : SPLongOperation timing out,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21754456/

相关文章:

android - 屏幕超时会破坏文本到语音应用程序

c# - 为什么我需要使用 Activator CreateInstance?

sharepoint - 如何检查用户是否有权访问 SharePoint 网站集

ms-access - 自动刷新 Access 2010 中的 Sharepoint 链接表?

VBA 跟踪文件使用情况

ffmpeg - ffprobe 无法将超时参数转换为 m3u8 中的 ts url

c# - 如何使用漩涡哈希检查文件哈希?

c# - 如何确定我的应用程序是否处于事件状态(有焦点)

c# - 在 C# 中使用带有数字节点的 JSON.decode razor webhelper?

node.js - 处理 MongoDB 中的(长期)连接丢失