How to Integrate SharpShooter Reports.Silverlight into the ASP.NET Website

  1. File->New Web Site
  2. Add new Silverlight Application and host it in the just created Web Site
  3. Add References in the ServerSide project:

Add new item WCF Service

Put ReportService.svc name for it

Delete IReportService.svc

Open App_Code\ReportRervice.cs and put the following code:

public class ReportService : PerpetuumSoft.Reporting.Silverlight.Server.ReportServiceBase

Rebuild your project and you will see that ReportService.cs icon changed from code icon to component icon.

After that you need to open designer of the component (context menu->Open Designer).

Pay attention that licenses.licx file is automatically created by Visual Studio in the root of the Web.Site. It’s one of the most important thing needed for the licensing process.

Put Report manager in the designer.

Click somewhere on the free space in the designer or select ReportService in the Properties window manually. Specify ReportManager for the ReportService in the properties window:

Next step will be connected with report creation technics and you may find expanded info in the SharpShooter.Reports documentation.

Put detail on the Designer form. Choose Untyped dataset

Open Tables->Add Sales Table->Add Columns into Table:

Product of string type, Amount of int type, Price of double type.

Open code behind and override OnLoadData method:  

protected override void OnLoadData(
    IDictionary<string, object> parameters,
    string reportName,
    PerpetuumSoft.Reporting.Components.ReportSlot reportSlot)
    DataRow dr = dataSet1.Tables[0].NewRow();
    dr["Product"] = "Potato";
    dr["Amount"] = 10;
    dr["Price"] = 2.33;
    dr = dataSet1.Tables[0].NewRow();
    dr["Product"] = "Tomato";
    dr["Amount"] = 20;
    dr["Price"] = 5.33;
    dr = dataSet1.Tables[0].NewRow();
    dr["Product"] = "Apple";
    dr["Amount"] = 23;
    dr["Price"] = 3.11;
    base.OnLoadData(parameters, reportName, reportSlot);

NOTE: Designer sometimes doesn’t call Initialize and it will take you much time to figure out what is wrong with your app. Check that your application contains the following code:

public ReportService()

Configure web.config

We need to make changes in web.config file to setup service we use to get the reports.

NOTE: During configuring of the WCF service keep in mind that no namespaces are used for classes anywhere in the App_Code folder.

Open your Web.Config and configure web service endpoint for IReportService interface stuff, endpoint for metadata exchanging, resources endpoint (REST endpoint for exports and images work):



        <behavior name="ReportServiceBehavior">

            <serviceMetadata httpGetEnabled="true" />

                <serviceDebug includeExceptionDetailInFaults="true" />




        <behavior name="webBehavior">

            <webHttp />





    <service behaviorConfiguration="ReportServiceBehavior" name="ReportService">

        <endpoint address=""


                <dns value="localhost" />



        <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />

        <endpoint address="rest"
                  bindingConfiguration="webHttpBindingConf" />





        <binding name="webHttpBindingConf">

            <security mode="None" />




        <binding name="basicHttpBindingConf">

            <security mode="None" />




NOTE: You need to specify aspNetCompatibilityEnabled into true (our caching algorithm uses it):

<serviceHostingEnvironment multipleSiteBindingsEnabled="true" aspNetCompatibilityEnabled="true"/>

The compatibility with ASMX services makes it possible for WCF services to access, for example, the HttpContext object and subsequently other ASP.NET intrinsic objects. The compatibility is required at two levels. One of them is mentioned above.

Secondly, developers need to explicitly choose the compatibility mode for a given WCF service by using the service AspNetCompatibilityRequirements attribute.
Open code behind of the service and put the following attribute for the ReportService class:

[AspNetCompatibilityRequirements(RequirementsMode = AspNetCompatibilityRequirementsMode.Required)]

Return to the designer.

Open ReportManager and add Data Source:

Add fileReportSlot. Open fileReportSlot and do some stuff with your report.

Pay attention that filereportslot should be also deployed and have appropriate filepath after deploying, or you may use urlReportSlot. InlineReportSlot is not a best choice for the WebSite, because there are plenty troubles due to the fact that website is compiled to several assemblies.

Save and close Designer and ReportManager form. Save one more time Ctrl-Shift-S

Pay attention that our report is called Report1 and see what port does your app have (I have “63949”).

Client side stuff:

Add references to:






Open MainPage.xaml put the component markup (My website name is WebSite2, my port is 63949):

<UserControl x:Class="SilverlightApplication1.MainPage"







    d:DesignHeight="300" d:DesignWidth="400">

    <Grid x:Name="LayoutRoot" Background="White">

        <ssr:ReportViewer x:Name="reportViewer" ServiceUrl="http://localhost:63949/WebSite2/ReportService.svc" ReportName="Report1"></ssr:ReportViewer>



Open codebehind:

public partial class MainPage : UserControl
    public MainPage()
        reportViewer.Loaded +=
            new RoutedEventHandler(reportViewer_Loaded);
    void reportViewer_Loaded(object sender, RoutedEventArgs e)

Finally, we get rewarded for our job :-)

Add Feedback