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

503.0 error when previewing reports

22 Answers 572 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
PaulH
Top achievements
Rank 1
PaulH asked on 07 Jun 2019, 12:13 PM

I'm fairly consistently getting a 503.0 error (server has been shutdown) when working with Telerik reports. This is an ASP.NET Core application, currently with a single report with 2 sub-reports. I've published the application to a test Azure app service and that fails pretty consistently when trying to preview the report each time. On most occasions the report opens but as soon as I switch to print preview I receive a report that the service has shutdown with a 503.0 error - racing shows this to be with ASPNetCoreModuleV2.

If I run the application in debug mode from my VS2017 on Windows 10 using IISExpress and Firefox browser, the application works fine and I can navigate around without any issues. If I then run the report it opens and displays correctly. I can switch to print preview and mostly that also shows correctly but when I try to export to PDF I get the 503.0 error. Sometimes the error will come up at print preview stage. The report runs from a SQL data source using a stored procedure. The 2 sub-reports run from separate stored procedures. They are all set to use the same application "ReportsConnection", passing 2 parameters to the report and consequent stored procedure. Can you provide some advice on what might be causing this problem or what to investigate to try to identify the issues?

22 Answers, 1 is accepted

Sort by
0
Todor
Telerik team
answered on 12 Jun 2019, 09:06 AM
Hi PaulH,

This is a new issue for us. The strange thing is that, if I understood correctly, the PDF export and Print Preview may work correctly or may fail when the application is deployed in Azure. The observed 503 error is also a new issue for us as it indicates unavailable service. Could you sent a trace log of the error - you may check how to set up a Trace Listener in .NET Core in the Troubleshooting reporting implementation into ASP.NET Core application KB article.

Additionally, you may check the following threads for possible approaches for tackling the problem.
Troubleshoot HTTP errors of "502 bad gateway" and "503 service unavailable" in Azure App Service
Aspnetcore deployment to App Service targeting .net framework cause error until AspNetCoreModuleV2 is switched back to AspNetCoreModule

Regards,
Todor
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
PaulH
Top achievements
Rank 1
answered on 12 Jun 2019, 10:08 AM
I have published the application to a test Azure app service running in a fairly minimal specification and it fails pretty consistently to display the report initially, let alone preview or export. It seems that if I throw more resource and the application then I can get the report to run but some guidelines on how much resource is required for it to work in Azure or configuration settings that should be made would be useful. Having said that, it should not be a resource problem when running in IISExpress from my development machine which is a high-spec i7 machine with 32GB RAM. The rest of the application, excluding the reporting, seems to work reliably in all cases. I'll perform some monitoring and see if I can get some indicators as to why the service is crashing (which is what I can only assume is occurring) when I'm using the reporting and come back to you but any other information you can provide to do with advice for publishing to Azure would be useful if you have it.
0
PaulH
Top achievements
Rank 1
answered on 13 Jun 2019, 09:13 AM
I've tried various things to get to the bottom of this but so far I've not made any real progress. I upscaled and outscaled my Azure test app up to approx £220/month setup (4 cores, 7GB RAM etc) and I can run the app and preview the report but any attempt to export to PDF fails with a 503 taking down the app service. When I'm running locally from IIS Express, sometimes the report will open and I can switch to preview and sometimes I can't. I've run it again this morning, launched the report which opens OK and I can scroll down it and view all the data I expect to see in it (it produces a 6 page document with 2 sub-reports included) but when clicking for print preview I get the attached screen. I'm more than willing to accept I'm doing something wrong or I'm missing some reference but I can't find what it is from the various documents you've provided or I've searched for. Given that I have issues in IISExpress locally I'm discounting Azure specific publish issues for now, making the assumption that whatever the problem is it most likely stems from the setup of the solution in some way. Any further advice?
0
PaulH
Top achievements
Rank 1
answered on 13 Jun 2019, 09:17 AM

Sorry, hit post too soon. I setup the trace and the tail part of the log is below - note there are no errors recorded anywhere in the log file - it just ends when the app hits 503:

Worker rendering threads count: 12
----------------------
Cache cleaning started
12/06/2019 11:39:28
Check period: 00:05:00
 
     1 Refreshes         00:00:00.1179746
     0 ReportInstances   00:00:00.0000023
     1 Clients           00:00:00.0039295
 
Total cache clean time: 00:00:00.1864792
SolutionNamexxxx Information: 0 : Unit.DotsPerInch = 96
Rendering thread 42 starts work.
 
*** ReportProcessor.ProcessReport STARTED ***
 
*** ProcessReport #0 STARTED ***
*** ProcessReport #0 DONE in 00:00:00.3725415 ***
 
*** ReportProcessor.ProcessReport DONE in 00:00:00.4198504 ***
 
 
*** RenderReport #0 STARTED ***
*** RenderReport #0 DONE in 00:00:00.3088494 ***
 
Rendering thread 42 finishes work.
Rendering thread 42 starts work.
 
*** ReportProcessor.ProcessReport STARTED ***
 
*** ProcessReport #0 STARTED ***
*** ProcessReport #0 DONE in 00:00:00.0267524 ***
 
*** ReportProcessor.ProcessReport DONE in 00:00:00.0380915 ***
 
 
*** RenderReport #0 STARTED ***
*** RenderReport #0 DONE in 00:00:00.4467759 ***
 
Rendering thread 42 finishes work.
0
PaulH
Top achievements
Rank 1
answered on 13 Jun 2019, 02:57 PM
Again, I have more information. I've changed the report viewer to print preview by default and that seems to be working better, both locally and on Azure having made some other configuration changes within the app. I've run tests on the ASP NET Core demo example locally and find that runs fine though I can't see any material differences between that solution and mine. I have found that I can export to CSV, Excel, Word and sometimes multiple exports before any failure occurs. However, export to PDF fails every time and export to PowerPoint seems not to work either.
0
Todor
Telerik team
answered on 17 Jun 2019, 08:32 AM
Hello PaulH,

According to the trace log the report has been processed and rendered server-side correctly, with no issues. Therefore, I assume that the problem may indeed happen when delivering it. What is the Storage type you use for the REST Service? After rendering successfully, the response to the Get Document Info request (on the screenshots I see that it is the one that fails) should be 200 OK, and the next request should be made for the document itself or its first page - Get Document Page or Get Document. Have you overridden some of our methods in the ReportsController?

You may check the Windows Event Viewer for additional information on the problem.
Fiddler may also give further details. You may send us the SAZ files recorded by Fiddler for local investigation.

Since the problem occurs also on IISExpress locally and is not specifically related to Azure, consider opening a support ticket and sending a runnable project for local investigation.

Regards,
Todor
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
PaulH
Top achievements
Rank 1
answered on 19 Jun 2019, 04:52 PM

Hi Todor.

I'm using the default FileStorage and I can see it creating a large hierarchy of files in the path I've requested locally. I did find an issue in the Event Viewer (id 2264) relating to Static Compression and that seemed to be caused because the path it was trying to access wasn't there. I created the related folder and ensured the security was correct and the warning went away but the problem hasn't. It's still absolutely consistent that any attempt to export to PDF when running in IISExpress fails by taking down the app pool it would appear so giving a 503.0 error. I also noted that my main project assembly and namespace were not the same and that was showing a difference in places so I've been and changed everything to be absolutely consistent for namespace and assembly and that has also had no impact on the issue. I will look at Fiddler and come back once I have.

0
Todor
Telerik team
answered on 24 Jun 2019, 10:33 AM
Hello PaulH,

The warning in the Event Viewer may not be related to the problem.
I hope the information from Fiddler would shed more light on the issue.

Regards,
Todor
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
Scott
Top achievements
Rank 1
answered on 09 Jul 2019, 02:40 AM
Have you made any progress resolving this?  I am having the exact same problem (error) when attempting to print from an ASP Core MVC application.
0
PaulH
Top achievements
Rank 1
answered on 09 Jul 2019, 08:03 AM
To be honest I've had no time to delve further into it. I find that the example reports Telerik supply work OK of course but our report, while it will preview OK most of the time (we have it set to open in print preview by default) cannot be exported to PDF at all. Other exports work, some of the time. The report is to produce a multi page document, it includes 2 sub-reports, relies on a SQL database connection getting the data using stored procedures with parameters, so is not at all easy to include in any "sample project" to submit for review. The basic structure of the report matches with a similar set of reports we did in a previous ASP.NET MVC app a few years ago and they worked fine, though they were only single page reports. It does seem to relate to the .NET Core implementation but as yet I can't prove anything useful. Have you been through the steps, Fiddler etc, they suggested to me to try that I've not been able to do yet?
0
PaulH
Top achievements
Rank 1
answered on 22 Jul 2019, 03:45 PM
I'm missing XPSRendering. When I added the Reporting Nuget package I also had to add the OpenXMLRendering package and I added the Reporting Services ASP.NET Core package. I've finally had a chance to trace on Azure and it's reporting that it can't find the XPSRendering module. I've updated to 13.1.19.618 but still XPSRendering has not been included in the solution. I can see that the demo solutions reference the XPSRendering library module. I tried referencing the module but it had no effect. Can you please advise how XPSRendering should be included in the project?
0
Todor
Telerik team
answered on 25 Jul 2019, 11:06 AM
Hi PaulH,

The XPS rendering is not supported for pure .NET Core projects - check Implemented Features and Limitations. This is due to technical difficulties with the implementation in .NET Core. Adding the XPS rendering for .NET Core is not in our immediate plans for the same reason. Our Azure demo is a .NET Framework project and XPS is available there.

Regards,
Todor
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
PaulH
Top achievements
Rank 1
answered on 25 Jul 2019, 11:16 AM

Hi Todor and thanks for your response. I have to say I understand that this issue is most likely documented in your Implemented Features and Limitations but considering how long I've been reporting this 503 error and the fact it's been trying to export to PDF that I'm a little surprised it has taken this long to get this particular key bit of information. That being said, we now have a .NET Core application hosted in Azure that will produce a report that can't be exported to PDF which is absolutely vital to the sign off of the project. Is there a simple change that can be made to achieve this? I have to admit this is the first .NET Core project we've done and while I've seen reference to targetting the full .NET Framework I'm not clear on what impact that would have on the rest of the project. Time is very much now of the essence so a quick response would be very much appreciated.

Thanks in advance

0
Todor
Telerik team
answered on 30 Jul 2019, 09:47 AM
Hi PaulH,

The issue with PDF export not working is not known for us and we were not able to reproduce it until now. Our demos work correctly and export successfully to PDF. You may try to adjust your project according to them.

The best that will work for us in order to investigate the problem will be a sample demonstrating it. We may be able to see something also in the Fiddler SAZ file recorded while the issue occurs. We would do our best to find out what is causing the error and how it could be fixed if you sent us any of those.

Note that we usually try to answer forum threads within 72 working hours. However, we do not guarantee a response in the forum.
If you want to be sure to receive an answer within 24 working hours, you should open a Support Ticket.

Regards,
Todor
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
PaulH
Top achievements
Rank 1
answered on 30 Jul 2019, 11:31 AM

Hi Todor.

I think we must be getting crossed wires here. The solution we have is an ASP.NET Core 2.2 web application with a SQL Azure backend database with Entity Framework Core for data access. We have a Telerik report viewer in the front end ASP.NET Core web app which will preview the report and from there we can export to Word and Excel. If we try to export to PDF it kills the web application and results in us receiving a 503.0 error and we have to restart the app service in the Azure management portal. Having delved deeper into what was going on via an Azure trace I picked up an entry telling me that we were missing the XPSRendering library - presumably used to produce the PDF export file. When I reported that I couldn't get the XPSRendering library into our solution you told me that XPSRendering is not supported "for pure .NET Core projects" and requires a full .NET Framework. So, what I'm simply trying to establish now is what is the easiest way to be able to retain all the development effort that's been expended on this project (and the cost of the Telerik licence of course) with the Telerik Reporting for producing the required reports and be able to export those reports to PDF? This project is in beta with the client testing all basic functionality and currently the only thing that doesn't work is the ability to export reports to PDF. How do we resolve this?

I will log a separate support ticket but if the answer will just be that XPSRendering is not support on pure .NET Framework projects then I'm not sure how much benefit that will be to anyone.

0
Todor
Telerik team
answered on 31 Jul 2019, 11:02 AM
Hi PaulH,

I have replied to the support ticket you opened on the topic. I will include the relevant part of my answer also here :

The XPS rendering is an extra functionality that requires Telerik.Reporting.XpsRendering.dll file that should be added manually to the project, e.g. our Visual Studio item templates do not add it automatically. The Reporting engine, when called, checks for the available external resources that are necessary for all the supported rendering formats. If an assembly that is required for any of the formats (e.g. Telerik.Reporting.XpsRendering.dll, Telerik.Reporting.OpenXmlRendering.dll) is missing, the engine will throw a first chance exception (i.e. passed to the debugger but not passed back to the application), which will be logged just to notify that the assembly is missing. This error will not distort in any way the workflow for the other renderings. Hence, PDF rendering does not depend on Telerik.Reporting.XpsRendering.dll file and the absence of this assembly cannot interfere with PDF rendering. In other words, the two problems are not related.

The PDF rendering logic is part of our main Telerik.Reporting assembly and does not require any additional assemblies, i.e. it is enabled by default with the installation of the product. PDF format is based on the IMAGE format - check PDF Rendering. Note that some Azure plans have restrictions related to the GDI+ that we use in IMAGE rendering - check GDI+ error or OutOfMemoryException on exporting or printing Telerik report from Azure WebSites KB article.

Regards,
Todor
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
Missing User
answered on 04 Nov 2019, 07:48 AM
Hi PaulH,

I was getting the same 503.0 server error and the whole issue was very similar to yours. I've implemented the reporting service in our existing .NET Core MVC 2.2 project and the error came before the viewer could load the report, but sometimes I could even load some data before crashing, although the rendering was finished in all cases. It is really hard to recreate the problem in a separate project, because even the amount of data the report needs to load has an effect on when the shutdown occurs. And it is also hard to debug the issue.
What seems to be the solution here is calling the default webhost builder only once. So instead of using the ConfigurationService class in Startup.cs from the demo project, I can simply inject the configuration and hosting environment into the ReportsController like this:
public ReportsController(IConfiguration configuration, IHostingEnvironment env)

If I try to run the CSharp.AspNetCoreDemo project with Kestrel only (e.g. dotnet run), I can't load the viewer, because it is complaining about the WebHostBuilder used inside ConfigurationService, but it runs fine by injecting the configuration directly like above.
I know it has been several months, but could you tell me how you injected the configuration to ReportsController in your project and let me know if the above did any help in your case?
0
PaulH
Top achievements
Rank 1
answered on 04 Nov 2019, 11:29 AM
The problem ended up being an issue to do with the new In Process hosting feature in ASP.NET Core 2.2. Apparently with .NET Core 2.1, not using the in process hosting feature in 2.2 (which is the approach I took) and also in .NET Core 3 with or without in process hosting would work fine. As I said, I edited the csproj file and took out the In Process hosting line and then it worked fine and is continuing to do so. We weren't ready to move up to 3.0.
0
Missing User
answered on 04 Nov 2019, 01:58 PM

Thank you for your reply. This is interesting. Using the method I mentioned above, the app worked fine with in process hosting, including pdf export. So I tried the old configuration and our app also produces the 503.0 error when I try to export pdfs. Having the same problem as you with exporting, I tried to run it with out-of-process hosting model as you suggested, which also worked fine. It seems like Kestrel can handle the situation where multiple IWebHosts are used in the same application, but IIS will fail at some point.

Can I ask how you get the configuration and inject it into the ReportsController currently?

0
Todor
Telerik team
answered on 05 Nov 2019, 02:50 PM

Hi Adam,

The issue is known for us and is explained in Export to PDF fails from ASP.NET Core 2.2 projects KB article. Actually I think it is a bug in .NET Core 2.2 that is fixed in .NET Core 3.

You may see how we provide the configuration to the ReportsController in the following articles:

Here is the sample code for .NET Core 3 (for .NET Core 2.1 and 2.2 it is slightly different):

public class ReportsController : ReportsControllerBase
{
    ...
    public ReportsController(ConfigurationService configSvc)
    {
		...
        this.ReportServiceConfiguration = new ReportServiceConfiguration
        {
            ReportingEngineConfiguration = configSvc.Configuration,
            ...
        };
    }
}

and here is our sample implementation of the ConfigurationService class:

public class ConfigurationService
{
    public IConfiguration Configuration { get; private set; }

    public IWebHostEnvironment Environment { get; private set; }
    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;
    }
}

and in the Configure method of the Startup class you add:

this.services.AddTransient(ctx => new Controllers.ReportsController(new ConfigurationService(env)));

Regards,
Todor
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
Missing User
answered on 06 Nov 2019, 06:23 AM

Hi Todor,

Thank you for your reply. I've seen that article about PDF exports, but your demos and our existing project that uses Reporting work fine with targeting .NET Core 2.2 and InProcess hosting. The only way I can reproduce the 503.0 error during PDF export was when I used this method below from your demo project to get the configuration and it was only occurring in our existing project.

//otherwise instantiate the default builder which will use the default appSettings.json and appSettings.{environment}.json files.
var defaultBuilder = Microsoft.AspNetCore.WebHost.CreateDefaultBuilder().Build();
var config = defaultBuilder.Services.GetService<IConfiguration>();

I would like to better understand the root of this problem, so I can be more confident about the fix and because we are planning to migrate more of our projects to .NET Core.

 

Regards.

Adam

0
Todor
Telerik team
answered on 08 Nov 2019, 04:27 PM

Hi Adam,

Our demos are targeting .NET Core 2.1 and the issue does not occur there. I confirm that the issue is reproducible when our demo is upgraded to .NET Core 2.2 with InProcess. We haven't researched the issue further as we have found a workaround for .NET Core 2.2 and the problem does not exist in .NET Core 3. We assumed that the newly introduced feature is not mature enough in .NET Core 2.2. The way web.config gets generated seems modified, which may be related to the problem. You may check ASP.NET Core In Process Hosting on IIS with ASP.NET Core 2.2 for more information on the matter. Does your original project use configuration settings? We need also to try other ways to provide the configuration to the Reports Controller.

Regards,
Todor
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
Tags
General Discussions
Asked by
PaulH
Top achievements
Rank 1
Answers by
Todor
Telerik team
PaulH
Top achievements
Rank 1
Scott
Top achievements
Rank 1
Missing User
Share this question
or