Blazor self hosted: wwwroot/Reports not found

Stimulsoft Reports.NET discussion
Post Reply
mrapi
Posts: 277
Joined: Sat Dec 20, 2008 1:08 am

Blazor self hosted: wwwroot/Reports not found

Post by mrapi »

Hi
I'm trying to use Stimulsoft for Blazor:
-I've created an empty Blazor WebAssembly App (ASP.NET Core Hosted) .NET 5
-in Client project I've added Stimulsoft.Reports.Blazor package
- from https://github.com/stimulsoft/Samples-B ... n%20viewerI copy wwwroot/Reports/TwoSimpleLists.mrt and to my wwwroot project folder
also replaced my Index.razor page with that one from example

Code: Select all

@page "/"
@using Stimulsoft.Base
@using Stimulsoft.Report
@using Stimulsoft.Report.Blazor
@inject HttpClient Http

<!--Report viewer-->
<StiBlazorViewer Report="@report" />

@code
{
    //Report object to use in viewer
    private StiReport report;

    protected override async Task OnInitializedAsync()
    {
        await base.OnInitializedAsync();

        //Init base font
         var fontBase64 = "...";
        StiFontCollection.AddFontBase64(fontBase64, "Segoe UI");

        //Create empty report object
        report = new StiReport();

        //Load report template
        var reportBytes = await Http.GetByteArrayAsync("Reports/TwoSimpleLists.mrt");
        report.Load(reportBytes);
    }
}
now when I run the project I got:
Failed to load resource: the server responded with a status of 404 () :44396/Reports/TwoSimpleLists.mrt:1

blazor.webassembly.js:1 crit: Microsoft.AspNetCore.Components.WebAssembly.Rendering.WebAssemblyRenderer[100]
Unhandled exception rendering component: Response status code does not indicate success: 404 (Not Found).
System.Net.Http.HttpRequestException: Response status code does not indicate success: 404 (Not Found).
at System.Net.Http.HttpResponseMessage.EnsureSuccessStatusCode()
at System.Net.Http.HttpClient.GetByteArrayAsyncCore(HttpRequestMessage request, CancellationToken cancellationToken)
at WebApplication2.Client.Pages.Index.OnInitializedAsync() in C:\Users\user\source\repos\WebApplication2\WebApplication2\Client\Pages\Index.razor:line 32
at Microsoft.AspNetCore.Components.ComponentBase.RunInitAndSetParametersAsync()
at Microsoft.AspNetCore.Components.RenderTree.Renderer.GetErrorHandledTask(Task taskToHandle)
d.printErr @ blazor.webassembly.js:1
seems that report file(TwoSimpleLists.mrt) is not found,but the file exists in wwwroot\Reports
what have I done wrong
thanks
Lech Kulikowski
Posts: 6198
Joined: Tue Mar 20, 2018 5:34 am

Re: Blazor self hosted: wwwroot/Reports not found

Post by Lech Kulikowski »

Hello,

We need some additional time to investigate the issue, we will let you know about the result.

Thank you.
#3786
mrapi
Posts: 277
Joined: Sat Dec 20, 2008 1:08 am

Re: Blazor self hosted: wwwroot/Reports not found

Post by mrapi »

Hi
I found a solution:renaming mrt file to xml seems to work
thanks
Lech Kulikowski
Posts: 6198
Joined: Tue Mar 20, 2018 5:34 am

Re: Blazor self hosted: wwwroot/Reports not found

Post by Lech Kulikowski »

Hello,

Thank you for the information.
Post Reply