Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Anonymous
Not applicable

PowerBIClient or HttpClient.SendAsync

Hello:

I am just curious if there is an advantage to use HttpClient.SendAsync (C# .Net Core application) to make PowerBI REST API Call , say get report in a group, by utilizing HttpClientFactory to create HttpClient. The reason I am asking is that I could not tell how PowerBIClient is created as demonstrated in most of Sample Projects provided by Microsoft is using

return New PowerBIClient(new Uri(...), new TokenCredentials(accessToken, "Bearer")

 Will that be reusing HttpClient to avoid known socket exhaustion issues? How is retry being handled with PowerBIClient? 

I am using .Net 5 web application to embed reports for our customers and use service principal if that matters. Thank you!

2 REPLIES 2
v-lionel-msft
Community Support
Community Support

Hi @Anonymous ,

 

"I am just curious if there is an advantage to use HttpClient.SendAsync (C# .Net Core application) to make PowerBI REST API Call"

What kind of advantages do you mean by 'advantage’?

 

Best regards,
Lionel Chen

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Anonymous
Not applicable

Hi, Lionel:

It's not really about advantage, it is more about best practice of using httpclient for REST API calls.  It does not seem to me that PowerBIClient is using httpclientfactory to create httpclient ,instead  it creates an httpclient every time a powerbiclient is created and get disposed everytime. This could cause the known socket exhaustion issue, or no? In addition, I could not find any information if PowerBIClient has any kind of mechnism to do retry kind of thing. Can you help? Thank you

 

 

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.