在 Microsoft.Graph SDK 中将 TimeOut 设置为更高的值 [英] Set TimeOut to a higher value in Microsoft.Graph SDK

查看:107
本文介绍了在 Microsoft.Graph SDK 中将 TimeOut 设置为更高的值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在使用 Microsoft.Graph 包的以下代码中经常遇到超时错误,

I get timeout error frequently with the below code using the Microsoft.Graph package,

await graphServiceClient.Users[UserId].Contacts.Request().AddAsync(contact);

由于没有选项(我可以找到)一次添加多个联系人,我将上述 LOC 并行调用.我有大约 500 个联系人要导入,其中许多未能给出超时响应

As there are no option (that I could find) for adding multiple contacts at a time, I was calling the above LOC parallel. I have around say 500 contacts to import and many of them fails giving the timeout response

异常:代码:超时消息:请求超时.

Exception: Code: timeout Message: The request timed out.

是否有任何选项可以在 Microsoft.Graph GraphServiceClient 中将 TimeOut 设置为更高的值?

Are there any option to set TimeOut to a higher value in Microsoft.Graph GraphServiceClient?

推荐答案

您可以将超时设置为更高的值,如下所示:例如将超时设置为一小时:

You can set the Timeout to a higher value like this: For example to set the Timeout to one hour:

graphServiceClient.HttpProvider.OverallTimeout = TimeSpan.FromHours(1);

这篇关于在 Microsoft.Graph SDK 中将 TimeOut 设置为更高的值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆