This is a migrated thread and some comments may be shown as answers.

Can I use Reports on .NET CORE 3.1?

8 Answers 261 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
robert
Top achievements
Rank 1
robert asked on 11 Jan 2020, 01:42 PM
with `<TargetFramework>netcoreapp3.1</TargetFramework>`?

8 Answers, 1 is accepted

Sort by
0
Neli
Telerik team
answered on 13 Jan 2020, 07:54 AM

Hi Robert,

Basically, you can follow the steps given in How To: Use HTML5 Report Viewer in an ASP.NET Core 3+ application article. Note that due to some changes between .NET CORE 3 and .NET CORE 3.1, there is a little difference in step2 in Setting up the ConfigurationService in the Startup.cs file. The code has to look as follows:

public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
{
    this.services.AddTransient(ctx => new Controllers.ReportsController(new ConfigurationService(env)));

    if (env.IsDevelopment())
    {
        app.UseDeveloperExceptionPage();
    }
    else
    {
        app.UseExceptionHandler("/Error");
        // The default HSTS value is 30 days. You may want to change this for production scenarios, see https://aka.ms/aspnetcore-hsts.
        app.UseHsts();
    }

    app.UseHttpsRedirection();
    app.UseDefaultFiles();
    app.UseStaticFiles();

    app.UseRouting();
    app.UseCors("MyPolicy");

    app.UseEndpoints(endpoints =>
    {
        endpoints.MapControllers().RequireCors("MyPolicy");
    });
}

In the attached file you can find a sample project. Before starting the application you might need to run the Upgrade Wizard.

 

Regards,
Neli
Progress Telerik

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
0
Vincent
Top achievements
Rank 1
answered on 28 Mar 2020, 03:06 PM

I get  the error as follow:

Cannot access the Reporting REST service. (serviceUrl = '../api/reports/'). Make sure the service address is correct and enable CORS if needed. (https://enable-cors.org)

0
Neli
Telerik team
answered on 01 Apr 2020, 08:24 AM

Hello Vincent,

This error indicates that the Telerik Reporting REST Service is not working properly.  Note that since R1 2020, we add dependency injection to the Web API controllers in .NET Core, so now the Reports Controller looks as follows:

[Route("api/reports")]
public class ReportsController : ReportsControllerBase
{
    public ReportsController(IReportServiceConfiguration reportServiceConfiguration)
        : base(reportServiceConfiguration)
    {
    }

    protected override HttpStatusCode SendMailMessage(MailMessage mailMessage)
    {
        throw new System.NotImplementedException("This method should be implemented in order to send mail messages");

        // using (var smtpClient = new SmtpClient("smtp01.mycompany.com", 25))
        // {
        //    smtpClient.DeliveryMethod = SmtpDeliveryMethod.Network;
        //    smtpClient.EnableSsl = false;

        // smtpClient.Send(mailMessage);
        // }
        // return HttpStatusCode.OK;
    }
}
Further information about the error can be found in Cannot access the Reporting REST service. (serviceUrl = '/api/reports'). Make sure the service address is correct and enable CORS if needed. (https://enable-cors.org) KB article.


Regards,
Neli
Progress Telerik

Progress is here for your business, like always. Read more about the measures we are taking to ensure business continuity and help fight the COVID-19 pandemic.
Our thoughts here at Progress are with those affected by the outbreak.
0
n/a
Top achievements
Rank 1
answered on 01 Aug 2020, 09:58 AM

Hi,

Do you have updated sample for the latest version and .NET Core 3.1? I've tried the attached sample above but it's not working and there are obsolete classes being use in the sample, even the the AspNetCoreDemo in the example folder is not working

0
Neli
Telerik team
answered on 05 Aug 2020, 01:45 PM

Hi Susandi,

In R1 2020 we made some improvements and now you can use Dependency Injection and pass the configuration settings in the constructor of the ReportsController. To remove the warning, you can follow How to fix ReportsControllerBase is obsolete warning KB article. 

Please, check the attached NET Core 3.1 project with the latest version of Telerik Reporting 14.1.20.618. Let us know if you need further help.

Regards,
Neli
Progress Telerik

0
n/a
Top achievements
Rank 1
answered on 13 Aug 2020, 08:18 AM
Thanks, I got it working but now I noticed that the rendering result is different between the .NET full framework and .NET Core, is there anything that I can do to get a more consistent result?
0
Neli
Telerik team
answered on 18 Aug 2020, 06:47 AM

Hi Susandi,

Can you give me more details about your environment while you are rendering the report in .NET Core? Note that for Linux or MacOS, we use libgdiplus which is not a perfect replacement for the Windows graphics library, the rendered reports may differ in terms of text positioning, word-wrapping and aligning.

You can also send me the generated PDF files of the report.

Regards,
Neli
Progress Telerik

-1
raresky
Top achievements
Rank 1
answered on 20 Apr 2021, 09:36 AM
NET Core 3.1 support which gives access to reporting applications from different platforms.
Tags
General Discussions
Asked by
robert
Top achievements
Rank 1
Answers by
Neli
Telerik team
Vincent
Top achievements
Rank 1
n/a
Top achievements
Rank 1
raresky
Top achievements
Rank 1
Share this question
or