<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Error when refreshing dataset via REST API in VB.net in Developer</title>
    <link>https://community.fabric.microsoft.com/t5/Developer/Error-when-refreshing-dataset-via-REST-API-in-VB-net/m-p/1398728#M25917</link>
    <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm using the following code to trigger a dataset refresh via the REST API and VB.net:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="csharp"&gt;      Dim redirectUri, resourceUri, authorityUri, clientID As String

        redirectUri = "https://dev.powerbi.com/Apps/SignInRedirect"

        resourceUri = "https://analysis.windows.net/powerbi/api"

        authorityUri = "https://login.windows.net/common/"

        Dim authContext As New AuthenticationContext(authorityUri, New TokenCache())

        clientID = My-Client-ID

        Dim authenticationResult As AuthenticationResult

        Try

            authenticationResult = Await authContext.AcquireTokenAsync(resourceUri, clientID, New Uri(redirectUri), New PlatformParameters(PromptBehavior.Auto))

            Dim s As HttpWebRequest
            Dim enc As UTF8Encoding
            Dim postdata As String

            s = HttpWebRequest.Create("https://api.powerbi.com/v1.0/myorg/groups/My-Workspace/datasets/My-Dataset/refreshes")

            s.Method = "POST"
            s.KeepAlive = True
            s.ContentLength = 0

            s.Headers.Add("Authorization", String.Format("Bearer {0}", authenticationResult.AccessToken))
            s.ContentType = "application/x-www-form-urlencoded"

            s.GetResponse()

        Catch ex As Exception
            MessageBox.Show(ex.Message)
        End Try&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This used to work perfectly. However suddenly I started to get an error at .GetResponse ("Connection closed..."). Does anyone have an idea where the problem could be? I updated all the involved nuget packages but that didn't help.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks for any help!&lt;/P&gt;</description>
    <pubDate>Mon, 28 Sep 2020 08:37:24 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2020-09-28T08:37:24Z</dc:date>
    <item>
      <title>Error when refreshing dataset via REST API in VB.net</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/Error-when-refreshing-dataset-via-REST-API-in-VB-net/m-p/1398728#M25917</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm using the following code to trigger a dataset refresh via the REST API and VB.net:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="csharp"&gt;      Dim redirectUri, resourceUri, authorityUri, clientID As String

        redirectUri = "https://dev.powerbi.com/Apps/SignInRedirect"

        resourceUri = "https://analysis.windows.net/powerbi/api"

        authorityUri = "https://login.windows.net/common/"

        Dim authContext As New AuthenticationContext(authorityUri, New TokenCache())

        clientID = My-Client-ID

        Dim authenticationResult As AuthenticationResult

        Try

            authenticationResult = Await authContext.AcquireTokenAsync(resourceUri, clientID, New Uri(redirectUri), New PlatformParameters(PromptBehavior.Auto))

            Dim s As HttpWebRequest
            Dim enc As UTF8Encoding
            Dim postdata As String

            s = HttpWebRequest.Create("https://api.powerbi.com/v1.0/myorg/groups/My-Workspace/datasets/My-Dataset/refreshes")

            s.Method = "POST"
            s.KeepAlive = True
            s.ContentLength = 0

            s.Headers.Add("Authorization", String.Format("Bearer {0}", authenticationResult.AccessToken))
            s.ContentType = "application/x-www-form-urlencoded"

            s.GetResponse()

        Catch ex As Exception
            MessageBox.Show(ex.Message)
        End Try&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This used to work perfectly. However suddenly I started to get an error at .GetResponse ("Connection closed..."). Does anyone have an idea where the problem could be? I updated all the involved nuget packages but that didn't help.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks for any help!&lt;/P&gt;</description>
      <pubDate>Mon, 28 Sep 2020 08:37:24 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/Error-when-refreshing-dataset-via-REST-API-in-VB-net/m-p/1398728#M25917</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2020-09-28T08:37:24Z</dc:date>
    </item>
    <item>
      <title>Re: Error when refreshing dataset via REST API in VB.net</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/Error-when-refreshing-dataset-via-REST-API-in-VB-net/m-p/1399096#M25923</link>
      <description>&lt;P&gt;In case anyone is having the same issue, I had to enable TLS 1.2 for the connection, which I did by adding this line in code:&lt;/P&gt;&lt;LI-CODE lang="csharp"&gt;System.Net.ServicePointManager.SecurityProtocol = System.Net.SecurityProtocolType.Tls12&lt;/LI-CODE&gt;&lt;P&gt;Reference &lt;A href="https://azure.microsoft.com/en-us/updates/power-bi-support-for-transportlayer-security/" target="_self"&gt;here&lt;/A&gt; and &lt;A href="https://community.powerbi.com/t5/Issues/Embedded-Power-BI-is-not-working/idi-p/1185996" target="_self"&gt;here.&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 28 Sep 2020 10:18:19 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/Error-when-refreshing-dataset-via-REST-API-in-VB-net/m-p/1399096#M25923</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2020-09-28T10:18:19Z</dc:date>
    </item>
  </channel>
</rss>

