gpt4 book ai didi

c# - HttpClient GetAsync 总是说 'WaitingForActivation'

转载 作者:太空狗 更新时间:2023-10-29 21:13:14 26 4
gpt4 key购买 nike

我是 HttpClient 的新手。我下面的代码总是在状态中显示“WaitingForActivation”。请帮忙

private static async Task<HttpResponseMessage> MakeCall()
{
var httpclient = new HttpClient();

var response = await httpclient.GetAsync("http://localhost:60565/Subscribers");

return response;
}

最佳答案

或者,如果您的环境是同步的,则添加 .Result,如下所示:

GetAsync("http://localhost:60565/Subscribers").Result;

关于c# - HttpClient GetAsync 总是说 'WaitingForActivation',我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18653012/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com