reporting-docs/knowledge-base/wpf-viewer-method-access-ex...

2.2 KiB

title page_title description slug previous_url tags published res_type type
The WPF ReportViewer Throws a MethodAccessException The WPF ReportViewer Throws a MethodAccessException Learn how to handle a method access exception when working with the WPF ReportViewer. telerikreporting/using-reports-in-applications/display-reports-in-applications/wpf-application/troubleshooting/wpf-reportviewer-troubleshooting /using-reports-in-applications/display-reports-in-applications/wpf-application/troubleshooting/wpf-reportviewer-troubleshooting#wpf-reportviewer-troubleshooting telerik, reporting, troubleshoot, wpf, reportviewer, method, access, exception, thrown, connecting, rest, service, report, server True kb troubleshooting

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]({%slug telerikreporting/using-reports-in-applications/display-reports-in-applications/wpf-application/how-to-use-wpf-report-viewer-with-report-server%}).