有关PowerBI的HttpWebRequest.GetResponse()的问题

时间:2019-07-02 19:03:28

标签: c# powerbi powerbi-datasource

我正在按照powerbi演练的示例获取数据集以将行添加到https://docs.microsoft.com/en-us/power-bi/developer/walkthrough-push-data-add-rows上的Power BI表中,并且在访问HttpRequest.GetResponse()时遇到问题。

所有天蓝色设置均已设置,并且能够通过代码成功生成令牌

    string token = authContext.AcquireToken(resourceUri, clientID, new 
    Uri(redirectUri)).AccessToken;        

但是我在HttpRequest的GetRespone上遇到一个问题,说无法从传输连接中读取数据:现有的连接被远程主机强行关闭。

    using (Stream writer = request.GetRequestStream())
        {
            writer.Write(byteArray, 0, byteArray.Length);

            var response = (HttpWebResponse)request.GetResponse(); //-->raises an issue Unable to read data from the transport connection: An existing connection was forcibly closed by the remote host.

0 个答案:

没有答案