Page 1 of 1

Blazor self hosted: wwwroot/Reports not found

Posted: Tue Mar 23, 2021 9:11 am
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

Re: Blazor self hosted: wwwroot/Reports not found

Posted: Thu Mar 25, 2021 9:15 am
by Lech Kulikowski
Hello,

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

Thank you.
#3786

Re: Blazor self hosted: wwwroot/Reports not found

Posted: Thu Mar 25, 2021 9:18 am
by mrapi
Hi
I found a solution:renaming mrt file to xml seems to work
thanks

Re: Blazor self hosted: wwwroot/Reports not found

Posted: Thu Mar 25, 2021 9:26 am
by Lech Kulikowski
Hello,

Thank you for the information.