首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Sharepoint客户端模型-请求超时

Sharepoint客户端模型-请求超时
EN

Stack Overflow用户
提问于 2012-08-01 00:55:04
回答 2查看 16.9K关注 0票数 1

我收到来自Sharepoint客户端托管对象模型的超时。

代码语言:javascript
复制
Microsoft.SharePoint.Client.ServerException: The operation has timed out.

基本上,我正在批量处理100个更新,并一次性发送它们。如果需要时间,对我来说没有问题,但我真的想避免超时异常。

我已经尝试了一百万种方法来增加客户端上下文中的超时,但都没有成功。在调用客户端上下文的executequery方法时,我使用反射来尝试识别sharepoint正在做什么。sharepoint基本上是创建一个HttpWebRequest并发送它。

我已经用下面的代码结束了,但仍然没有成功:

代码语言:javascript
复制
 public static void SetInfinteTimeout(this ClientContext ctx)
{
    int timeout = 10 * 60 * 1000;
    ctx.RequestTimeout = timeout;
    ctx.PendingRequest.RequestExecutor.RequestKeepAlive = false;            
    ctx.PendingRequest.RequestExecutor.WebRequest.KeepAlive = false;
    ctx.PendingRequest.RequestExecutor.WebRequest.Timeout = timeout;
    ctx.PendingRequest.RequestExecutor.WebRequest.ReadWriteTimeout = timeout;            
    System.Net.ServicePointManager.DefaultConnectionLimit = 200;
    System.Net.ServicePointManager.MaxServicePointIdleTime = 2000;
    System.Net.ServicePointManager.MaxServicePoints = 1000;
    System.Net.ServicePointManager.SetTcpKeepAlive(false, 0, 0); 
    ServicePointManager.DnsRefreshTimeout = timeout; // 10 minutes       

}

但是我仍然收到一个超时错误!

我还有什么遗漏的吗?

任何帮助都将不胜感激。

EN

回答 2

Stack Overflow用户

回答已采纳

发布于 2012-08-11 13:29:59

解决方案是使用客户端可调用集(SPWebApplication.ClientCallableSettings):

http://msdn.microsoft.com/en-us/library/microsoft.sharepoint.administration.spwebapplication.clientcallablesettings.aspx

它有一个执行超时属性和其他相关设置。

票数 0
EN

Stack Overflow用户

发布于 2012-08-02 06:39:09

你试过了吗?

  • keeping KeepAlive (true)、
  • disabling Timeout和
  • keeping MaxServicePointIdleTime value (默认情况下为100秒,但您设置为2)。

就像:

代码语言:javascript
复制
public static void SetInfiniteTimeout(this ClientContext ctx)
{
    ctx.RequestTimeout = -1;  //ctx.RequestTimeout or System.Threading.Timeout.Infinite;
}

另外,在您当前的配置中,您需要多少秒才能获得超时错误?

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/11745231

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档