调用API

时间:2016-05-07 14:44:25

标签: office365 microsoft-graph

我在调用API时收到内部服务器错误,可能与Azure中的权限有关吗?

请参阅以下代码:

using (var request = new HttpRequestMessage(HttpMethod.Get, Settings.GetMeUrl))
                        {
                            request.Headers.Accept.Add(Json);

                            request.Headers.Authorization = new AuthenticationHeaderValue("Bearer", Request.RequestContext.HttpContext.Session[SessionKeys.Login.AccessToken].ToString());

using (var response = await client.SendAsync(request))
{
//response has internal server error 500 ( see below)
....
}

返回异常 {StatusCode:500,ReasonPhrase:'Internal Server Error',版本:1.1,内容:System.Net.Http.StreamContent,Headers: {   转移编码:分块   request-id:832422ea-f685-4119-8616-fa544b681467   client-request-id:832422ea-f685-4119-8616-fa544b681467   x-ms-ags-diagnostic:{“ServerInfo”:{“DataCenter”:“East US”,“Slice”:“SliceB”,“ScaleUnit”:“000”,“Host”:“AGSFE_IN_4”,“ADSiteName” :“美东时间”}}   持续时间:356.9558   缓存控制:私有   日期:2016年5月7日星期六14:36:11 GMT   服务器:Microsoft-IIS / 8.5   X-Powered-By:ASP.NET   Content-Type:application / json }}

请求内容: {方法:GET,RequestUri:'https://graph.microsoft.com/v1.0/me',版本:1.1,内容:,标题: {   接受:application / json   授权:承载eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiIsIng1dCI6Ik1uQ19WWmNBVGZNNXBPWWlKSE1iYTlnb0VLWSIsImtpZCI6Ik1uQ19WWmNBVGZNNXBPWWlKSE1iYTlnb0VLWSJ9.eyJhdWQiOiJodHRwczovL2dyYXBoLm1pY3Jvc29mdC5jb20vIiwiaXNzIjoiaHR0cHM6Ly9zdHMud2luZG93cy5uZXQvMmIxOWFjMTMtYWNkOC00NjdiLTgyZGMtN2I4NWFkNWExN2ZmLyIsImlhdCI6MTQ2MjYzMTQ0NiwibmJmIjoxNDYyNjMxNDQ2LCJleHAiOjE0NjI2MzUzNDYsImFjciI6IjEiLCJhbHRzZWNpZCI6IjU6OjEwMDM3RkZFOTdBNUY3OUYiLCJhbX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