Progress® Telerik® Reporting R2 2017

How To: Use WPF Report Viewer With Report Server

This topic explains how to setup the WPF Report Viewer to work with Telerik Report Server

Prerequisites

  • Installed and running Telerik Report Server R2 2016 (2.1.16.x) or higher version.

  • A valid (enabled) user account - the built-in Guest user account can be used as well.

  • In case you are not using Item Templates, add references to all the assemblies listed here.

Configuring the WPF Report Viewer to work with Report Server

  1. To create a window and host the report viewer in it, you can either use the item template, as explained here, or place it yourself through drag-and-drop from the toolbox.

  2. As soon as the report viewer is on your form, select it and locate the ReportEngineConnection property. invoke the UI editor by pressing the ellipsis button. The Report Engine Connection dialog should appear:

    wpf-connection-editor-report-server
  3. The Reporting engine combobox provides the following options:

    • Embedded - the reports will be processed and rendered at the local machine that hosts the viewer. This is the default mode in order to preserve backwards compatibility.

    • REST Service - the reports will be processed at the machine that hosts configured and running REST Service instance.

    • Report Server - the reports will be processed and rendered at the machine that hosts configured and running Telerik Report Server instance.

    Select Report Server.

  4. In Report Server URL textbox enter the address and port (if needed) of the machine that hosts the Report Server instance.

  5. In Username textbox enter the user account that will be used to access the report or leave it empty if you want to use the built-in Guest account.

  6. In Password textbox enter the password associated with the account or leave it empty if you want to use the built-in Guest account.

  7. Click OK when ready. The dialog will close and the resulting connection string will be populated as a value of the ReportEngineConnection property.

  8. Locate the ReportSource property. Invoke the UI editor by pressing the New button. The default property editor, provided by Visual Studio, should appear:

    Wpf Report Source Editor
    Important note Important

    When the ReportEngineConnection property has Engine set to RestService or ReportServer, the viewer will serialize the report source identifier property (URI for UriReportSource, TypeName for TypeReportSource, ReportDocument for InstanceReportSource and XML for XmlReportSource) and send it to the service resolver.

    The ReportServer will try to decompose the identifier using the format {Category}/{ReportName} and then look for the corresponding category and report name.

  9. In this scenario we will use a UriReportSource. Select the UriReportSource entry. Confirm by clicking OK.

  10. Expand the ReportSource node in Properties window. In the provided Uri textbox enter the category and the name of the report you want to display using the following format: {Category}/{ReportName}, as shown below:

    Wpf Set Uri Report Source Property Grid
  11. Build and run your application. If your settings are configured correctly, you should see the report, hosted on your Report Server instance, displayed in the report viewer of your WPF application. If not, check the Troubleshooting section below.

Important note Important

When setting ReportEngineConnection with code, make sure you call the RefreshReport() method or set the ReportSource property afterwards, so the connection's new value will be respected.

Troubleshooting

The most common reasons for failure are related with the authentication against Report Server. It is strongly recommended to use a tool like Fiddler or any other web debugger when investigating such a problem.

Problem

Cause

The viewer displays the message: A problem occurred while registering client.

Check if the supplied username and password are valid and the user's state is Enabled in Report Server.

The viewer displays the message: System.OperationCanceledException: {ReportName} report cannot be found

Make sure the URL specified in the report source report is valid and such a category and report exist in Report Server.

The viewer displays the message: System.Net.WebException: The remote name could not be resolved: {server name}

Make sure that the server specified in the connection string exists and has a valid and running Report Server instance.

See Also