Silverlight Viewer for Reporting Services Getting Started (Local
Download as PDF: GettingStartedSSRS2005LocalConnection.pdf
PLEASE BE ADVISED THAT LOCAL REPORTS GENERATION IS POSSIBLE ONLY
WITH SILVERLIGHT VIEWER FOR REPORTING SERVICES 2005 AND VISUAL STUDIO 2008.
Creating Web application using the build-in report processing.
- .NET Framework 3.5 SP1
- Silverlight v3
- Silverlight v3 SDK
- Silverlight v3 Developer Tool
- Visual Studio 2008
- Microsoft SQL Reporting Services Sample Reports
The target of the following guide is to demonstrate the basic
moments of the use of Silverlight Viewer for Reporting Services. It gives minimum
necessary knowledge in order to start working with the component. We will examine
the process of generation of web application with the use of Silverlight Viewer
for Reporting Services step by step. We will consider creation and configuration
of the service and at last integration of the report viewer component on the application
Creating Web application
Create a new Silverlight Application project named SampleApplication.
While creation of the project select the menu item “Add a new
ASP.NET Web project to the solution to host Silverlight” and set name of the web-project
Set specific port to 5555 in the “Web” tab of the SampleApplication.Server
properties (in the "Solution Explorer", item “Properties” in contextual
menu of the SampleApplication.Server).
Next, set SampleApplication.Server project as Startup Project.
Add Perpetuumsoft.Reporting.Silverlight.Server.Core and PerpetuumSoft.Reporting.Silverlight.Server.ReportingServices
assemblies to the project references, (in "Solution Explorer", item “Add
Reference” in context menu of SampleApplication.Server). These assemblies are located
in the Bin folder of the Silverlight Viewer for Reporting Services installation
Add WCF service named ReportService.svc to the SampleApplication.Server
Inherit a new ReportService class from the MsReportServiceBase
class for implementation and opportunity to change standard behavior. In order to
make ASP.Net context available for the service, service class needs to be marked
by a special AspNetCompatibilityRequirements attribute. The ASP.Net context is required
for the service to cache document data, if other mechanism of data storage is not
public class ReportService : MsReportServiceLocal
Step 5. Now it’s necessary to setup created web-service. Make
changes in the web.config file. System.serviceModel section must be as follows:
The first endpoint is intended for work with the report, for
instance, to get pages. The second endpoint is intended for work with the resources,
for instance, to get localization. And, at last, the third endpoint is used to get
meta-information about the service.
The Report Service can work over SSL. To do it you need extended
service definition in the web.config file. Add some definition into binding element.
NOTE: If you set Security Mode equal to Transport you have to
set ServiceUrl of ReportViewer to “https://...”
Now it’s necessary to set data source and report template. In
order to do this you should add named DataSet to project (in "Solution Explorer",
item “Add -> New Item” in context menu of SampleApplication.Server). Select “Data”
item and then “DataSet” item. Enter NWindDataSet.xsd in the Name field and click
Now you need to add TableAdapter to DataSet. In DataSet Designer
press “Add -> Table Adapter…”
Firstly, press the “New Connection…” button in TableAdapter Configuration
Wizard. Select “Microsoft Access Database File” in the “Choose Data Source” window
and click the “Continue” button.
Click the “Browse” button in the “Add Connection” window and
select database file: NWIND.MDB. This file is located in the Resources\Data folder
of the Silverlight Viewer for Reporting Services installation folder. Leave the
User name and Password fields empty and click “OK”.
Click “Next” after you completed the creation of a new NWIND.MDB
Press “Yes” to copy the file to the App_Data folder of the SampleApplication.Server
Secondly, select the “Use SQL statements” item in TableAdapter
Configuration Wizard and press the “Next” button.
Thirdly, add the following SQL statement to field in TableAdapter
Configuration Wizard and click “Finish”.
SELECT EmployeeID, LastName, FirstName, Address, Photo, Notes
Now you need to add a new Report file to the project (in "Solution
Explorer", item “Add -> New Item” in context menu of SampleApplication.Server).
Select the “Reporting” item and then the “Report” item. Rename the report to "Employees.rdlc".
Now create a report template with Visual Studio 2008 methods
and use data from NWindDataSet.
At last, data source should be set to ReportService in special
overriden GetReportDataSources method inherited from MsReportServiceLocal.
public override IList<LocalReportDataSource>
= new List<LocalReportDataSource>();
if (reportName == "Employees.rdlc")
EmployeesTableAdapter ta =
You can use report name and it’s parameters values to create
the list of data source objects.
It’s necessary to add the report viewer component to the Silverlight
application for the report display. Therefore you should add a reference to the
PerpetuumSoft.Reporting.Silverlight.MsReporting.Client assembly, containing ReportViewer
(in "Solution Explorer", item Add Reference in context menu of SampleApplication).
This assemble is located in the Bin folder of the Silverlight Viewer for Reporting
Services installation folder.
Open MainPage.xaml in the markup designer and add xml namespace
for the PerpetuumSoft.Reporting.Silverlight.MsReporting.Client assembly.
Then add ReportViewer and set ServiceUrl="http://localhost:5555/ReportService.svc"
NOTE: We suppose you have Microsoft SQL Reporting Services installed
Open the MainPage.xaml.cs source code and add the following code.
public partial class MainPage : UserControl
Loaded += new RoutedEventHandler(Page_Loaded);
void Page_Loaded(object sender, RoutedEventArgs e)
RenderDocument method invocation leads to the rendering of the
current report on the server and its displaying in the Report Viewer.
Set the SampleApplication.Server application as a starting one
and launch it.
We have examined basic steps and got a simple and quite operable
application. We didn’t have to write thousand lines of code – we only used ready-made
implementation. It will be enough in the most cases. If required behavior differs
greatly from the one provided by default, you can change not only many aspects of
the Silverlight Viewer for Reporting Services work but also the appearance of the
ssrs Silverlight Viewer for Reporting Services Local Connection