"Make sure the service address is correct and enable CORS if needed. (https://enable-cors.org)" error in .NET Core web api

1 Answer 498 Views
.NET Core Report Designer - Web
Lasitha
Top achievements
Rank 1
Iron
Lasitha asked on 14 Feb 2023, 09:42 AM

I'm trying to implement Telerik web report designer to blazer .NET MAUI hybrid app, and it keep giving above mentioned error when I try to view the created. report. But I have already add Cors to the app.

{
    ReportingEngineConfiguration = sp.GetService<IConfiguration>(),
    HostAppId = "newcumstomreportAPI",
    Storage = new FileStorage(),
    ReportSourceResolver = new UriReportSourceResolver(
        Path.Combine(Environment.CurrentDirectory, "Reports"))
});
builder.Services.AddSingleton<IReportDesignerServiceConfiguration>(sp => new ReportDesignerServiceConfiguration
{
    DefinitionStorage = new FileDefinitionStorage(Path.Combine(Environment.CurrentDirectory, "Reports")),
    SettingsStorage = new FileSettingsStorage(Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), "Telerik Reporting")),
    ResourceStorage = new ResourceStorage(Path.Combine(Environment.CurrentDirectory, "Resources"))
});

builder.Services.AddCors();

var app = builder.Build();




app.UseStaticFiles();
//app.UseCors(MyAllowSpecificOrigins);
app.UseCors(builder =>
                builder.WithOrigins("*")
                .AllowAnyHeader()
                .AllowAnyMethod()
            );

app.UseRouting();

app.UseEndpoints(endpoints =>
{
    endpoints.MapControllers();
});
Is it possible to add web report designer to Blazor Hybrid?

1 Answer, 1 is accepted

Sort by
0
Dimitar
Telerik team
answered on 16 Feb 2023, 01:59 PM

Hello Lasitha,

Thank you for the provided information!

The error message indicates that there is some kind of issue with the Report Designer service, please see the Cannot access the Reporting REST service KB article for details on how to troubleshoot this issue.

I also recommend going over the How to set up in .NET 5 and .NET Core 3.1 applications - Telerik Reporting article and ensuring that you have implemented all required steps.

For example, in the code snippet inside your reply, I did not see NewtonsoftJson and the Controllers being added to the service:

builder.Services.AddControllers().AddNewtonsoftJson();

The integration demos, while not specific to MAUI, should also help you figure out what might be missing or incorrect in your project. These projects are shipped with the installation of the product and can be found at the following path:

C:\Program Files (x86)\Progress\Telerik Reporting <Release>\Examples\CSharp

The Web Report Designer is implemented in all .NET Core web application projects there.

Lastly, I would suggest reading the Telerik Reporting Conquers .NET MAUI and .NET MAUI Blazor blog post which despite being focussed on the Report Viewer, should also give hints on how to set up the Web Report Designer.

If further assistance would be needed, please send me a runnable project with the issues and I will have a look at it locally.

Regards,
Dimitar
Progress Telerik

Brand new Telerik Reporting course in Virtual Classroom - the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products. Check it out at https://learn.telerik.com/.
Tags
.NET Core Report Designer - Web
Asked by
Lasitha
Top achievements
Rank 1
Iron
Answers by
Dimitar
Telerik team
Share this question
or