The WPF ReportViewer Throws a MethodAccessException
Environment
Product | Progress® Telerik® Reporting |
Version | Q2 2012 and later |
Report Viewers | WPF |
Description
When connecting the WPF Report Viewer to the Telerik Report Server or Telerik Reporting REST API Service, a MethodAccessException
error is thrown.
Error Message
Attempt by method 'Telerik.Reporting.Services.HttpClient.HttpRequestHelper.GetResponseFromPost(System.Net.Http.HttpResponseMessage)'
to access method 'Telerik.Reporting.Services.HttpClient.HttpRequestHelper.GetResponseFromPost<T>
(System.Net.Http.HttpResponseMessage, System.Collections.Generic.IEnumerable 1<System.Net.Http.Formatting.MediaTypeFormatter>)' failed.
Cause
The most common reason for this exception is an incorrect version of the web client assemblies. The WPF viewer requires the Microsoft.AspNet.WebApi.Client
NuGet package.
Solution
Install the assemblies required by the WPF viewer through the Visual Studio NuGet Package Manager or with the Visual Studio Package Manager Console. For more details, refer to the article on using the WPF ReportViewer with the Report Server.