We have reports deployed to a report server and they've been working great. All of the sudden, they are now throwing an error: Error loading the report viewer's templates. (Template = http://server/api/reports/resources/templates/telerikReportViewerTemplate-html). In dev tools it has: XMLHttpRequest cannot load http://server/api/reports/resources/templates/telerikReportViewerTemplate-html. The 'Access-Control-Allow-Origin' header has a value 'http://localhost:10969' that is not equal to the supplied origin. Origin 'http://someOtherServer' is therefore not allowed access.
We call the reports from two different domains (azurewebsites and then a custom subdomain). How can we accomplish this?
Thanks,
Nick
8 Answers, 1 is accepted
The Reporting REST WebAPI based Service is a controller for which you can enable CORS. The linked article is an external tutorial describing the required Nuget packages, and the settings for the Reporting REST service's project.
If you use Telerik Report Server, it is configured for CORS. The viewer calling the Report Server should be of the same version as the Report Server e.g., Report Server 2.2.16.1025 corresponds to v10.2.16.1025 of Telerik Reporting and its resources like HTML5 Viewer. Report Server R1 2017 is expected in March.
I hope this helps.
Regards,
Stef
Telerik by Progress

Hello Stef,
To enable CORS, we need to make reference Microsoft.AspNet.WebApi.Cors assembly files. But dependencies versions are >5.0.0. Your Telerik.Reporting.Services.WebApi assemblies are compatible with Microsoft.AspNet.WebApi.WebHost.4.0.30506. That's why we can't access-control-allow-origin. That is the main problem.

Hi Nick,
I also facing the sample problem like you. Are you OK with your problem?
Regards,
Thawdar
Reporting REST service is built against WebAPI 1. If you use a newer version of Microsoft.AspNet.WebApi.WebHost add a binding redirect for the System.Web.Http and System.Net.Http.Formatting to their newer version in the application configuration file.
Regards,
Katia
Progress Telerik

We have ensured that the Report Viewer version is the same as the Report Server but we still receive the following error:
Cannot access the Reporting REST service. (serviceUrl = 'http://www.paper-man.net:83/api/reports'). Make sure the service address is correct and enable CORS if needed. (https://enable-cors.org)
CAn you help?
This error message is generic and suggests the most common reason for problems related with Reporting REST API. The problem might be caused by some error that happened on the server or some serialization issue due to incorrect version of NewtonsoftJson or System.Net.Http assemblies. In such cases Fiddler (or any other web debugging proxy) can be really useful to inspect the requests and their responses and see where exactly the problem happens. Additionally you can attach a trace listener to the ReportServer's web.config file and see if it will log any errors, but ultimately Fiddler should show where the problem is.
You can also try using a different browser to see if the issue persists. Inspecting the browser's Console and Network tab might also provide some useful information about the issue.
If you need further assistance, please open a new support ticket and send us the project with the report viewer so we can investigate it on our side.
Regards,
Ivan Hristov
Progress Telerik

Hi Ivan - clearly not an "out of the box product".
What Microsoft products do we need to have installed on our server (and which versions) in order for your product to work.
Kind regards,
John Stevens
The scenario where HTML5-based report viewer is connected to Report Server should work out-of-the-box and is supported by our Item Template Wizards. However, modern web applications need to reference many other assemblies (usually through NuGet packages) and it's easy to have them misconfigured.
On the Report Server side, there should be no additional configurations, as long as the Report Server is running and is able to preview reports.
On the client side, assemblies that will handle the request-response workflow and serialize and deserialize the web contents should be added to the project, like for example System.Net.Http, System.Net.Http.Formatting, Newtonsoft.Json and their dependencies. We strongly recommend to configure the report viewer using the Item Template wizard, because it will add the necessary NuGet packages to the project - see this article for reference: How To: Use HTML5 Report Viewer with Report Server.
In order to provide further assistance, we'll need to inspect the configuration of the current project. I suggest to open a new support ticket and send us the project so we can investigate it on our side.
Regards,
Ivan Hristov
Progress Telerik