【发布时间】:2021-08-10 06:52:47
【问题描述】:
我的 C# 代码一定有问题。我正在尝试从 Azure Blob 下载一些 Json。我可以在 Postman 和 MS Edge 中下载 Json,但是,使用我的代码,请求中没有明显的错误,但响应中没有内容。大概是我的代码有问题。
async Task GetJson()
{
var request = new HttpRequestMessage
{
Method = new HttpMethod("GET"),
RequestUri = new Uri("https://xxx.blob.core.windows.net/trading/m5.json")
};
request.Headers.Add("Accept", "application/json");
request.SetBrowserRequestMode(BrowserRequestMode.NoCors);
var response = await http.SendAsync(request);
var json = await response.Content.ReadAsStringAsync();
}
【问题讨论】: