Azure Data Lake Gen2 API标头错误

编程入门 行业动态 更新时间:2024-10-17 13:36:33
本文介绍了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标头错误

本文发布于:2023-11-14 19:58:05,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1588376.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:错误   Data   Azure   Lake   API

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!