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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

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
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.