Advance your Data & AI career with 50 days of live learning, dataviz contests, hands-on challenges, study groups & certifications and more!
Get registeredGet Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Learn more
I am able to successfully connect to and run some methods using the PowerBIClient. However, when I try to actually render the paginated report I get an exception of "Unable to read data from the transport connection: An existing connection was forcibly closed by the remote host."
Here is the full code:
var accessToken = await tokenAcquisition.GetAccessTokenForUserAsync(new string[] {
PowerBiScopes.ReadReport,
PowerBiScopes.ReadDataset,
});
var userInfo = await graphServiceClient.Me.Request().GetAsync();
var userName = userInfo.Mail;
AuthDetails authDetails = new AuthDetails {
UserName = userName,
AccessToken = accessToken,
};
var credentials = new TokenCredentials($"{accessToken}", "Bearer");
PowerBIClient powerBIClient = new PowerBIClient(credentials);
var groups = await powerBIClient.Groups.GetGroupsAsync();
var swiftGroup = groups.Value
.Where(x => x.Name == "SWIFT Application Development")
.FirstOrDefault();
var swiftReports = await powerBIClient.Reports.GetReportsAsync(swiftGroup.Id);
var s0AuditSheet = swiftReports.Value
.Where(x => x.Name == "S0 A - Audit Sheet")
.FirstOrDefault();
var paginatedReportExportConfiguration = new PaginatedReportExportConfiguration {
ParameterValues = new ParameterValue[] {
new ParameterValue { Name = "OSCode", Value = "9477"},
},
Identities = new List<EffectiveIdentity> {
new EffectiveIdentity { Username = "kevin.grigsby@lubrizol.com" },
}
};
var exportRequest = new ExportReportRequest {
Format = FileFormat.PDF,
PaginatedReportConfiguration = paginatedReportExportConfiguration,
};
Export result = null;
try {
result = await powerBIClient.Reports.ExportToFileInGroupAsync(swiftGroup.Id, s0AuditSheet.Id, exportRequest);
} catch (Exception e) {
string b = e.Message;
}
return result.Id;
It gets all the way to the `try` block on the ExportToFileInGroupAsync and then fails with:
Unable to read data from the transport connection: An existing connection was forcibly closed by the remote host.
If I go here and click the Try It button I get a 202 response code and the expected output. What is the problem here?
If I need to tack on an EffectiveIdentity or something else I need to see actual code please. I have been pulling out my hair trying to get this last bit to work for a week now.
Solved! Go to Solution.
Turns out the issue was on our side, more specifically, security/firewall settings. Here is the exact quote from our networking guru.
"After some more investigation we determined that our firewall was causing this issue when it was terminating the SSL connection. We were able to add a bypass for the URL and it is now working as expected."
Turns out the issue was on our side, more specifically, security/firewall settings. Here is the exact quote from our networking guru.
"After some more investigation we determined that our firewall was causing this issue when it was terminating the SSL connection. We were able to add a bypass for the URL and it is now working as expected."
Hi @Anonymous ,
Please refer this official documentation to update the codes as below and check whether you can get the expected result.
|
.... return result.Id; |
If you still can't get the expected result, please use the following methods to get the error log and share it with us in order to make troubleshooting.
1. F12
2. Use fiddler
Best Regards
I am using Blazor here which seems to block/hide those requests. I have a more detailed and latest info here at Stack Overflow.
Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!
Check out the October 2025 Power BI update to learn about new features.
| User | Count |
|---|---|
| 3 | |
| 2 | |
| 1 | |
| 1 | |
| 1 |