Blazor Web Assembly ASP.NET Core Hosted + RadzenSSRSViewer: IFRAME displays mirror of website instead of SSRS Report

My objective of this post is to share with the RADZEN community the problem that I did encounter with RadzenSSRSViewer and how I resolved\worked around the same blocker issue, so anyone else facing the issue can benefit from the solution\work-around.

Objective: Display SSRS Report in Blazor Web Assembly PWA which is hosted on internal IIS Server using ASP.NET Core (.NET 6) using RadzenSSRSViewer with Proxy set to true in order to authenticate the website user using common SSRS authenticated credentials.

Issue Encountered: In developer environment, the SSRS report was previewed successfully using the awesome RadzenSSRSViewer but when I hosted the PWA on IIS and tried to access the report, then instead of generating and displaying the SSRS report, the IFRAME of RadzenSSRSViewer would mirror the parent website with Page Not Found Error.

Root Cause: Blazor PWA tried to navigate user to available downloaded cached pages and does not go the server but interestingly when we hit CTRL+F5 the SSRS report would previewed successfully.

Solution Source:

Solution:

  1. Go to the published folder > wwwroot
  2. Edit the service-worker.published.js or service-worker.js (Which every you are using on Live instance)
  3. Replace the following line of code:
  • Original Code:
    const shouldServeIndexHtml = event.request.mode === 'navigate';

  • Modified for RadzenSSRSViewer:
    const shouldServeIndexHtml = event.request.mode === 'navigate' && !event.request.url.includes('/__ssrsreport?') && !event.request.url.includes('/ssrsproxy/');

The above will force Blazor PWA to go to __ssrsreport or ssrsproxy located on Server in Radzen's ReportController.cs > [HttpGet("/__ssrsreport")] & [Route("/ssrsproxy/{*url}")] instead of searching for local page named __ssrsreport in the cached content within the boundary of index.html.

1 Like