Azure Data Lake Gen2 API标头错误 [英] Azure Data Lake Gen2 API Header Error

查看:67
本文介绍了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($"https://{account}.dfs.core.windows.net/");
                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 thread and let us know if it helps. Else, we can gladly continue to probe in further.


这篇关于Azure Data Lake Gen2 API标头错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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