本文介绍了Azure Data Lake Gen2 API标头错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在尝试直接调用gen2 rest端点并继续收到错误,我错过了所需的标头(MissingRequiredHeader消息)未指定此请求必需的HTTP标头。我看不到哪个标头是我用使用以下代码发送请求。
I am trying to call the gen2 rest endpoint directly and keep getting an error that I am missing a required header (MissingRequiredHeader message An HTTP header that's mandatory for this request is not specified. I fail to see what header is missing. I'm using the following code to send the request.
var client = new HttpClient(); client.BaseAddress = new Uri($"{account}.dfs.core.windows/"); client.DefaultRequestHeaders.Accept.Clear(); client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json")); client.DefaultRequestHeaders.Add("api_version", "2018-11-09"); client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", _authResult.AccessToken); string azPath = $"{baseRawSystemPath}/{path.Replace("\\", "/")}"; byte[] bytes = Encoding.UTF8.GetBytes(content); HttpContent body = new StringContent(content, Encoding.UTF8, "application/json"); HttpResponseMessage response = await client.PutAsync(azPath, body); if (response.IsSuccessStatusCode) { var responseListingJson = await response.Content.ReadAsStringAsync(); return; } else { var error = await response.Content.ReadAsStringAsync(); return; }
推荐答案
嗨尼尔森,
我发现了一个类似的线程可能对你有用案件也是如此。请查看上的答案 此主题并告诉我们是否有帮助。否则,我们很乐意继续进一步探讨。
I found a similar thread that might be useful in your case as well. Please have a look at the answer on this threadand let us know if it helps. Else, we can gladly continue to probe in further.
更多推荐
Azure Data Lake Gen2 API标头错误
发布评论