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.
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!
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.
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
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
13 | |
2 | |
2 | |
1 | |
1 |
User | Count |
---|---|
20 | |
3 | |
2 | |
2 | |
2 |