New to Telerik Reporting? Download free 30-day trial

Integrating the WPF Report Viewer With Report Server

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

Prerequisites

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 in the article How to Add report viewer to a WPF .NET Framework project, 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:

    An image ofthe Report Engine Connection dialog with Report Server option selected

  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. In the Document timeout textbox you can change the timeout for rendering a document, the default is 100 seconds.
  8. Uncheck the Keep client alive checkbox if you want the client session to expire.
  9. Click OK when ready. The dialog will close and the resulting connection string will be populated as a value of the ReportEngineConnection property.
  10. Locate the ReportSource property. Invoke the UI editor by pressing the New button. The default property editor, provided by Visual Studio, should appear:

    An image of the Wpf Report Source Editor with UriReportSource being the selected option

    When the ReportEngineConnection property has the Engine set to ReportServer, the viewer will serialize the report source identifier property (URI for the supported UriReportSource) 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.

  11. Select the UriReportSource entry. Confirm by clicking OK.

  12. 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:

    An image of the WPF UriReportSource Property Grid where the report and its parameters can be set

  13. 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.

When setting ReportEngineConnection with code, make sure you call the RefreshReport() method or set the ReportSource property afterward, 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

In this article