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

Cross Origin

8 Answers 1145 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Nick
Top achievements
Rank 1
Nick asked on 10 Feb 2017, 07:52 PM

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

Sort by
0
Stef
Telerik team
answered on 13 Feb 2017, 12:54 PM
Hello Nick,

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
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
Thawdar
Top achievements
Rank 1
answered on 02 Jan 2018, 10:06 AM

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. 

0
Thawdar
Top achievements
Rank 1
answered on 02 Jan 2018, 10:07 AM

Hi Nick,

I also facing the sample problem like you. Are you OK with your problem?

 

Regards,

Thawdar

0
Katia
Telerik team
answered on 04 Jan 2018, 02:34 PM
Hello 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
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
John
Top achievements
Rank 1
answered on 25 Jun 2019, 04:29 PM

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?

0
Ivan Hristov
Telerik team
answered on 28 Jun 2019, 10:44 AM
Hi John,

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
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
John
Top achievements
Rank 1
answered on 28 Jun 2019, 11:50 AM

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

0
Ivan Hristov
Telerik team
answered on 01 Jul 2019, 10:18 AM
Hi John,

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
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
Nick
Top achievements
Rank 1
Answers by
Stef
Telerik team
Thawdar
Top achievements
Rank 1
Katia
Telerik team
John
Top achievements
Rank 1
Ivan Hristov
Telerik team
Share this question
or