目前,我在 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))
{
}
托马斯
关于c# - SharePoint 2013 : SPLongOperation timing out,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21754456/