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

Problem when Hosting Telerik report in Net 5

2 Answers 63 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Tuan
Top achievements
Rank 1
Tuan asked on 11 Apr 2021, 04:36 PM

Hi All,

I follows  this link https://docs.telerik.com/reporting/telerik-reporting-rest-service-aspnetcore-net5 to try

hosting Hosting Telerik report ( 2021 R1) in Net 5  but have error

" CS0117: ReportServiceConfiguration does not  contained a definition for ''ReportingEngineConfiguration "

when Configure dependencies for ReportsController. in Startup.cs file :

public void ConfigureServices(IServiceCollection services)
{

........

            services.TryAddSingleton<IReportServiceConfiguration>(sp =>
                new ReportServiceConfiguration
                {
                    ReportingEngineConfiguration = ConfigurationHelper.ResolveConfiguration(sp.GetService<IWebHostEnvironment>()),
                    HostAppId = "Net5RestServiceWithCors",
                    Storage = new FileStorage(),
                    ReportSourceResolver = new UriReportSourceResolver(
                        System.IO.Path.Combine(sp.GetService<IWebHostEnvironment>().ContentRootPath, "Reports"))
                });

}

Please help me to fixed this !

Ths

2 Answers, 1 is accepted

Sort by
0
Neli
Telerik team
answered on 15 Apr 2021, 05:58 AM

Hello Tuan,

I am sorry to hear that you are experiencing issues with our product.

Can you please test the approach that we have applied in our demos:

 services.TryAddSingleton<IReportServiceConfiguration>(sp =>
     new ReportServiceConfiguration
     {
         // The default ReportingEngineConfiguration will be initialized from appsettings.json or appsettings.{EnvironmentName}.json:
         ReportingEngineConfiguration = sp.GetService<IConfiguration>(),

         // In case the ReportingEngineConfiguration needs to be loaded from a specific configuration file, use the approach below:
         // ReportingEngineConfiguration = ResolveSpecificReportingConfiguration(WebHostEnvironment),
         HostAppId = "ReportingNet5",
         Storage = new FileStorage(),
         ReportSourceResolver = new TypeReportSourceResolver()
             .AddFallbackResolver(new UriReportSourceResolver(reportsPath))
     });

Let me know if that resolves the issue.

Regards,
Neli
Progress Telerik

Тhe web is about to get a bit better! 

The Progress Hack-For-Good Challenge has started. Learn how to enter and make the web a worthier place: https://progress-worthyweb.devpost.com.

0
Tuan
Top achievements
Rank 1
answered on 21 Apr 2021, 02:34 PM

Hi Neli ,

Thanks for your reply. I have fixed my problem as youtube link : https://www.youtube.com/watch?v=wlSkbkaFoBU&feature=youtu.be

Rgs

Tags
General Discussions
Asked by
Tuan
Top achievements
Rank 1
Answers by
Neli
Telerik team
Tuan
Top achievements
Rank 1
Share this question
or