C# 挂起返回跟踪来自关系终结点的数据

C# 挂起返回跟踪来自关系终结点的数据,c#,instagram-api,instasharp,C#,Instagram Api,Instasharp,我正在尝试从Instagram API返回一个跟踪用户列表。我在一个沙箱帐户上使用InstaSharp.NET包装器 用户经过身份验证后,将调用操作方法 public ActionResult Following() { var oAuthResponse = Session["InstaSharp.AuthInfo"] as OAuthResponse; if (oAuthResponse == null) { return RedirectToAct

我正在尝试从Instagram API返回一个跟踪用户列表。我在一个沙箱帐户上使用InstaSharp.NET包装器

用户经过身份验证后,将调用操作方法

public ActionResult Following()
{
    var oAuthResponse = Session["InstaSharp.AuthInfo"] as OAuthResponse;

    if (oAuthResponse == null)
    {
        return RedirectToAction("Login");
    }

    var info = new InstaSharp.Endpoints.Relationships(config_, oAuthResponse);

    var following = info.Follows("10").Result;

    return View(following.Data);
}

尝试使方法始终异步,而不是执行阻塞调用
。Result
,这可能会导致死锁

public async Task<ActionResult> Following() {
    var oAuthResponse = Session["InstaSharp.AuthInfo"] as OAuthResponse;

    if (oAuthResponse == null) {
        return RedirectToAction("Login");
    }

    var info = new InstaSharp.Endpoints.Relationships(config_, oAuthResponse);

    var following = await info.Follows("10");

    return View(following.Data);
}
这看起来像是你的冒烟枪在调用
.Result
此任务的调用堆栈越高,将导致出现死锁


参考

显示整个操作方法以及如何调用它。很可能是混合了异步调用和阻塞调用,即:
.Result
,这有可能导致死锁。好的,数据返回0个结果。不确定这是否是沙盒应用程序的限制。@Tariq但它已停止挂起?最初的问题是什么,对吗?我对那个API了解得不够。我只是想确定您最初描述的问题的已知原因。
public static async Task<T> ExecuteAsync<T>(this HttpClient client, HttpRequestMessage request)