我使用GraphServiceClient成功调用Microsoft Graph几个月没有任何问题。突然间,我收到了很多服务异常。
我知道您应该在这里发布请求ID,但是当整个请求似乎包含在库方法中时,我不知道如何获取它。无论哪种方式,我都需要找出为什么会发生这些异常。下面是一个导致异常的代码示例,以及生成的堆栈跟踪及其发生的时间
// Get groups.
IGraphServiceUsersCollectionPage gusers =
await graphClient.Users
.Request()
.GetAsync();
GraphUsers.AddRange(gusers.CurrentPage);
while (gusers.NextPageRequest != null) {
gusers = await gusers.NextPageRequest.GetAsync();
GraphUsers.AddRange(gusers.CurrentPage);
}
堆栈追踪:
2018-04-30 10:16:30.477
Microsoft.Graph.ServiceException: Code: generalException Message: Unexpected exception returned from the service.
at Microsoft.Graph.HttpProvider.<SendAsync>d__19.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.Graph.BaseRequest.<SendRequestAsync>d__36.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.Graph.BaseRequest.<SendAsync>d__32`1.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.Graph.GraphServiceUsersCollectionRequest.<GetAsync>d__4.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)