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

Could not generate the preview of report items in web designer

1 Answer 166 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Tursunkhuja
Top achievements
Rank 2
Iron
Iron
Veteran
Tursunkhuja asked on 09 Aug 2020, 06:34 PM

Hello,
We are using Telerik Reporting version R2 2020.
In our app to show report we use HTML5 Report Viewer and Web Report designer. Our project based on .Net Core 3.1. Currently, the report viewer is working fine but we have a problem with a web designer. I tested report web designer with a web page using the Chrome browser and it is not working fine. It shows some error messages when loading some report items. For example in my sample project I'm trying to open barcode report with report web designer. After a few seconds It shows some error messages saying "Could not generate the preview of 'barcode N'" (N - barcode number).  

You can see this from the attached picture file. I could not attache my sample project because it allows only picture file.

Here my Startup file.

    public class Startup
    {
        // This method gets called by the runtime. Use this method to add services to the container.
        public void ConfigureServices(IServiceCollection services)
        {
            services.AddCors(o => o.AddPolicy("AllowOrigin", builder =>
            {
                builder.AllowAnyOrigin().AllowAnyHeader().AllowAnyMethod();
            }));

            //This is for showing picture
            services.Configure<IISServerOptions>(options =>
            {
                options.AllowSynchronousIO = true;
            });

            services.AddRazorPages()
                .AddNewtonsoftJson();

            //Designer
            // Configure dependencies for ReportServiceConfiguration.
            services.TryAddSingleton<ConfigurationService>(sp => new ConfigurationService(sp.GetService<IWebHostEnvironment>()));
            services.TryAddScoped<IReportSourceResolver>(sp =>
                new TypeReportSourceResolver().AddFallbackResolver(new UriReportSourceResolver(
                    Path.Combine(sp.GetRequiredService<ConfigurationService>().Environment.WebRootPath, "Reports"))));
            services.TryAddScoped<IReportServiceConfiguration>(sp =>
                new ReportServiceConfiguration
                {
                    ReportingEngineConfiguration = sp.GetRequiredService<ConfigurationService>().Configuration,
                    HostAppId = "Html5DemoAppCore",
                    Storage = new FileStorage(),
                    ReportSourceResolver = sp.GetRequiredService<IReportSourceResolver>()
                });

            // Configure dependencies for ReportDesignerServiceConfiguration.  
            services.TryAddScoped<IDefinitionStorage>(sp => new FileDefinitionStorage(Path.Combine(sp.GetRequiredService<ConfigurationService>().Environment.WebRootPath, "Reports")));
            services.TryAddScoped<IReportDesignerServiceConfiguration>(sp => new ReportDesignerServiceConfiguration { DefinitionStorage = sp.GetRequiredService<IDefinitionStorage>() });
        }

        // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
        public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
        {
            app
             .UseRouting()
             .UseCors("AllowOrigin")
             .UseDefaultFiles()
             .UseStaticFiles()
             .UseEndpoints(config =>
             {
                 config.MapControllers();
             });
        }
    }

    public class ConfigurationService
    {
        public ConfigurationService(IWebHostEnvironment environment)
        {
            this.Environment = environment;
            var configFileName = System.IO.Path.Combine(environment.ContentRootPath, "appsettings.json");
            var config = new ConfigurationBuilder()
                            .AddJsonFile(configFileName, true)
                            .Build();
            this.Configuration = config;
        }
        public IConfiguration Configuration { get; private set; }
        public IWebHostEnvironment Environment { get; private set; }
    }

Can someone help me to solve this problem?
Thank you,



1 Answer, 1 is accepted

Sort by
0
Nasko
Telerik team
answered on 12 Aug 2020, 02:35 PM

Hi Tursunhuja,

Please open the AspNetCoreDemo project in the Telerik Reporting installation folder (C:\Program Files (x86)\Progress\Telerik Reporting R2 2020\Examples\CSharp\Asp.NetCoreDemo). There you will find a sample implementation of the web report designer. Run this project and head to the URL localhost:port/webReportDesigner.html.

The page should look like this:

Let us know if any errors come up when loading this page. You can compare the settings of this project to your project settings.

In order to send us a runnable project as a zip file, please open a support ticket.

Regards,
Nasko
Progress Telerik

Tags
General Discussions
Asked by
Tursunkhuja
Top achievements
Rank 2
Iron
Iron
Veteran
Answers by
Nasko
Telerik team
Share this question
or