当前,我在SharePoint 2013中遇到SPLongOperation的问题。我有一些自定义逻辑,至少需要15分钟来处理,因此我使用SPLongOperation来确保6分钟后不会超时。过去,这段代码可在SharePoint 2010上使用。问题是代码执行恰好在6分钟后停止。附加调试器后,它不会超时,因此SPLongOperation块会被忽略或无法正常工作。我用来调用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)语句测试了此块,以确保业务逻辑不会引起问题。
也有这个问题,找到这种方法,在创建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/
托马斯
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句