So I've managed to create a report in a Class Library and I want to render this report in my SL Viewer.
As per http://www.telerik.com/help/reporting/silverlight-report-viewer-embedding_the_silverlight_viewer.html
I have to bind the "Report" and "ReportServiceUri". I'm looking for a little information on specifically how to do this in my scenario as I'm not using a WCF service but RIA / EF.
Can you please point me in the right direction .. I'm having trouble finding specifics.
Many thanks.
Mark
26 Answers, 1 is accepted
Cheers!
First you should add the .svc file (ReportService.svc) to your .web project not (the RIA class library) and put this line inside:
<%@ServiceHost Service="Telerik.Reporting.Service.ReportService, Telerik.Reporting.Service, Version=x.x.x.x, Culture=neutral, PublicKeyToken=A9D7983DFCC261BE" %>
Go to your SL application and add a new user control to host your report.
1- add reference to Telerik.ReportViewer.Silverlight in your SL application.
2- add user control and optionaly put this xaml code inside:
<
Grid
x:Name
=
"LayoutRoot"
Background
=
"White"
>
<
my:ReportViewer
x:Name
=
"reportviewer"
ReportServerUri
=
"../ReportService.svc"
Report
=
"ReportsLibrary.Report1, ReportsLibrary, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null"
/
</Grid>
run your application to open that usercontrol and you shall see your report ...
Best regards
Specifically, as previously mentioned I'm using EF Ria hosted in Azure (including SQL Azure). While creating reports I understand that I need to provide a connection string so that I can render reports during construction, which is a local SQL db.
When I publish this up to Azure, my expectation is that the telerik rendering service running on my Silverlight.Web project will use the existing connection string from EF. Can you please confirm or correct that understanding. With that said, I'm receiving the following, and the report hangs on rendering at "loading page"
An exception has occurred while processing '' item:
Telerik.Reporting.Processing.Data.SqlDataSourceException: Unable to establish a connection to the database. Please, verify that your connection string is valid. In case you use a named connection string from the application configuration file, make sure the name is correct and the connection string settings are present in the configuration file of your application.
I've added the local SQL connection to my Silverlight.Web connections, and the rendering still hangs on thethe Loading Page indicator but provides no errors in the Output window. The log is below. I have no idea where to look at this point. The reports renders fine in the Report builder.
Microsoft.WindowsAzure.ServiceRuntime Verbose: 500 : Role instance status check starting
Microsoft.WindowsAzure.ServiceRuntime Verbose: 502 : Role instance status check succeeded: Ready
Microsoft.WindowsAzure.ServiceRuntime Verbose: 500 : Role instance status check starting
Microsoft.WindowsAzure.ServiceRuntime Verbose: 502 : Role instance status check succeeded: Ready
'w3wp.exe' (Managed (v4.0.30319)): Loaded 'C:\Windows\assembly\GAC_MSIL\Telerik.Reporting.Service\5.0.11.603__a9d7983dfcc261be\Telerik.Reporting.Service.dll'
'w3wp.exe' (Managed (v4.0.30319)): Loaded 'C:\Windows\assembly\GAC_MSIL\Telerik.ReportConverter.ActiveReports\5.0.11.603__a9d7983dfcc261be\Telerik.ReportConverter.ActiveReports.dll'
'w3wp.exe' (Managed (v4.0.30319)): Loaded 'C:\Windows\assembly\GAC_MSIL\Telerik.ReportConverter.CrystalReports\5.0.11.603__a9d7983dfcc261be\Telerik.ReportConverter.CrystalReports.dll'
'w3wp.exe' (Managed (v4.0.30319)): Loaded 'C:\Windows\assembly\GAC_MSIL\Telerik.ReportConverter.XtraReports\5.0.11.603__a9d7983dfcc261be\Telerik.ReportConverter.XtraReports.dll'
'w3wp.exe' (Managed (v4.0.30319)): Loaded 'C:\Windows\assembly\GAC_MSIL\Telerik.Reporting.XpsRendering\5.0.11.603__a9d7983dfcc261be\Telerik.Reporting.XpsRendering.dll'
'w3wp.exe' (Managed (v4.0.30319)): Loaded 'C:\Windows\assembly\GAC_MSIL\Telerik.Reporting.OpenXmlRendering\5.0.11.603__a9d7983dfcc261be\Telerik.Reporting.OpenXmlRendering.dll'
'w3wp.exe' (Managed (v4.0.30319)): Loaded 'C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.Windows.Forms\v4.0_4.0.0.0__b77a5c561934e089\System.Windows.Forms.dll', Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'w3wp.exe' (Managed (v4.0.30319)): Loaded 'C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.Design\v4.0_4.0.0.0__b03f5f7f11d50a3a\System.Design.dll', Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
*** ReportProcessor.Render STARTED ***
*** ReportProcessor.GetRenderer STARTED ***
*** ReportProcessor.GetRenderer DONE in 00:00:00.0047888 ***
*** ProcessReport #0 STARTED ***
'w3wp.exe' (Managed (v4.0.30319)): Loaded 'C:\Windows\Microsoft.Net\assembly\GAC_MSIL\PresentationFramework\v4.0_4.0.0.0__31bf3856ad364e35\PresentationFramework.dll', Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'w3wp.exe' (Managed (v4.0.30319)): Loaded 'C:\Windows\Microsoft.Net\assembly\GAC_MSIL\WindowsBase\v4.0_4.0.0.0__31bf3856ad364e35\WindowsBase.dll', Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'w3wp.exe' (Managed (v4.0.30319)): Loaded 'C:\Windows\Microsoft.Net\assembly\GAC_64\PresentationCore\v4.0_4.0.0.0__31bf3856ad364e35\PresentationCore.dll', Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
*** Report Processing STARTED ***
*** Report Processing DONE in 00:00:00.1162257 ***
*** Measure Report (Horizontal) STARTED ***
*** Measure Report (Horizontal) DONE in 00:00:00.0474162 ***
*** Measure Report (Vertical) STARTED ***
*** Measure Report (Vertical) DONE in 00:00:00.4397671 ***
*** ProcessReport #0 DONE in 00:00:01.3412563 ***
*** RenderReport #0 STARTED ***
*** RenderReport #0 DONE in 00:00:00.3784547 ***
*** ReportProcessor.Render DONE in 00:00:01.8039531 ***
http://www.telerik.com/community/forums/reporting/telerik-reporting/timeout-in-silverlight-reportviewer-with-wcf-reportservice-svc.aspx
however it appears that the binding still timesout at approx 1 minute.
Here is my relevant code:
Report hosting page:
XAML:
<
navigation:Page
xmlns:my
=
"clr-namespace:Telerik.ReportViewer.Silverlight;assembly=Telerik.ReportViewer.Silverlight"
x:Class
=
"RoasterWerks.Report"
xmlns:d
=
"http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc
=
"http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:navigation
=
"clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Navigation"
mc:Ignorable
=
"d"
d:DesignWidth
=
"850"
d:DesignHeight
=
"750"
Style
=
"{StaticResource PageStyle}"
<
sdk:Page.Resources
>
</
sdk:Page.Resources
>
<
Grid
x:Name
=
"LayoutRoot"
>
<
ScrollViewer
x:Name
=
"PageScrollViewer"
Style
=
"{StaticResource PageScrollViewerStyle}"
>
<
StackPanel
x:Name
=
"ContentStackPanel"
>
<
TextBlock
x:Name
=
"HeaderText"
Style
=
"{StaticResource HeaderTextStyle}"
Text
=
"{Binding Path=ApplicationStrings.ReportPageTitle, Source={StaticResource ResourceWrapper}}"
/>
<
my:ReportViewer
x:Name
=
"ReportViewer"
VerticalAlignment
=
"Stretch"
HorizontalAlignment
=
"Stretch"
ReportServerUri
=
"../Services/ReportService.svc"
Height
=
"650"
/>
</
StackPanel
>
</
ScrollViewer
>
</
Grid
>
</
navigation:Page
>
CS
namespace RoasterWerks
{
using System.Windows.Controls;
using System.Windows.Navigation;
using Telerik.ReportViewer.Silverlight;
using Telerik.Reporting.Service.SilverlightClient;
using System.ServiceModel;
using System;
/// <
summary
>
/// <
see
cref
=
"Page"
/> class to present information about the current application.
/// </
summary
>
public partial class Report : Page, IReportServiceClientFactory
{
/// <
summary
>
/// Creates a new instance of the <
see
cref
=
"About"
/> class.
/// </
summary
>
public Report()
{
InitializeComponent();
this.Title = ApplicationStrings.ReportPageTitle;
this.ReportViewer.ReportServiceClientFactory = this;
ReportViewer.Report = "ReportLibrary.Report1, ReportLibrary, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null";
}
/// <
summary
>
/// Executes when the user navigates to this page.
/// </
summary
>
protected override void OnNavigatedTo(NavigationEventArgs e)
{
}
ReportServiceClient IReportServiceClientFactory.Create(System.Uri remoteAddress)
{
var binding = new BasicHttpBinding()
{
MaxBufferSize = int.MaxValue,
MaxReceivedMessageSize = int.MaxValue,
ReceiveTimeout = new TimeSpan(0, 15, 0),
SendTimeout = new TimeSpan(0, 15, 0),
OpenTimeout = new TimeSpan(0,15,0),
CloseTimeout = new TimeSpan(0,15,0)
};
var endpointAddress = new EndpointAddress(remoteAddress);
return new ReportServiceClient(binding, endpointAddress);
}
}
}
Server Error in '/' Application.
Unable to cast object of type 'System.DBNull' to type 'System.Byte[]'.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.Exception Details: System.InvalidCastException: Unable to cast object of type 'System.DBNull' to type 'System.Byte[]'.
Source Error:
An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below. |
Stack Trace:
|
http://blogs.msdn.com/b/sqlazure/archive/2010/08/04/10046103.aspx
This seems to be the root of the failure because if I change the Web.config session state to Off as follows, there report renders:
<sessionState mode="InProc" sqlConnectionString="data source=.\SQLEXPRESS;Initial Catalog=RoasterWerks;Integrated Security=SSPI" cookieless="true" timeout="20"/>
But if I try and use SQLServer mode with my own database, it fails as described above.
Here is the configuration I use for the SQLServer mode:
<sessionState mode="SQLServer"
sqlConnectionString="Data Source=OFFICE\SQLEXPRESS;Initial Catalog=RoasterWerks;Integrated Security=True;MultipleActiveResultSets=True"
cookieless="false" timeout="7200" allowCustomSqlDatabase="true" />
Please advise when you can. Thanks very much.
Cheers!
Thanks I have. Unfortunately it isn't relevant because I'm operating within Silverlight. It also doesn't address this specific concern of sessionstate...but thanks
Mark
As far as we can see from researching upon the error and from comments in the blog post you referrenced (http://blogs.msdn.com/b/sqlazure/archive/2010/08/04/10046103.aspx), this error is usually due to either missing permissions or missing functions in SQL Azure. Additionally it seems Microsoft do not officially support SQL Session State Management, which is probably due to SQL Azure not being a complete counterpart for normal SQL Server.
Kind regards,
Steve
the Telerik team
Thank you for your follow up, however this does not speak to the failure when attempting the same connection mode on a localhost. If we remove the "Azure" variable (which I just referenced for clarity purposes), Telerik reporting still fails when using the Microsoft supported method of custom SQL tables to store session state.
Can you please address this concern from that perspective and not Azure.
Thanks,
Mark
I will open up a ticket so that I can upload same.
If you would like to reset my support, terrific. If not the file can be accessed from:
http://cid-081c1f35d99a6022.office.live.com/browse.aspx/.Public/Telerik?uc=1
Thanks,
Mark
The trial support license includes 60 days free support, which have elapsed for your account. If you would need more time testing our products, please contact our sales department with request to extend your trial period.
About the problem at hand - thank you for the sample project. After configuring the SQL Server to store ASP.NET session state to your database, it created two additional tables for its purposes, which were missing from your sql script i.e. we assume you have not configured the session state correctly or at least you have not configured it to use your database. This is the exact command I used to register it:
aspnet_regsql.exe -sstype c -E -d TelerikDemoDB -ssadd
After the registration, your project worked correctly and I have attached a short video that shows our observations.
Best wishes,
Steve
the Telerik team
Thanks for your work on this.
Understood about the 60 days...unfortunately I didn't have opportunity to start to examine the solution until the last week. I'll reach out to sales to see if they are willing to be accommodating.
In my main project where I'm having difficulty I do have those two tables. It must have been an oversight in respect to the sample I tried to provide. I'll look deeper into the differences between the two to see if I can discover the culprit.
Thanks again for your willingness to try and resolve. The report feature is really the make / break decision maker on whether I can go with Telerik or move in another direction, which I am loathe to do. Experience with Telerik controls and people has been fantastic to date.
Mark
A quick follow up, since you state that it hangs with infinite loading. Show the Output window in Visual Studio and check whether there is an exception when you're running your application in debug mode. If there is no exception does it show that the report render has finished? If so, then you can use Fiddler to check the response from the server and specifically the raw html as it might contain an error message or something that might lead you to the problem.
All the best,
Steve
the Telerik team
Hi Steve,
No error and the Fiddler trace is above (re: Server Error in '/' Application) comes from the fiddler window. At the moment I’m thinking it has to do with Windows Authentication (which you selected) versus SQL authentication (which I’ve chosen in my actual project). I’m trying to bang that around right now to confirm.
Again I appreciate your direct efforts very much. I've also reached out to sales via email and requested a small support extension.
Kind regards,
Mark
I have not changed anything in your project including authentication, so I am not sure to what selection you talk about. The error message from the screenshot is the same you reported in previous post, but as you saw, we cannot reproduce it on our end with the project you provided. Any additional details or differences in your local project that you can think of would be highly appreciated.
P.S. have you tried running your project on another machine? This way we can exclude the possibility of this being a local issue. If you can reproduce this error on another machine and provide us with the exact steps you used to set up your app on the other machine would probably help us, identify what is wrong on your end.
All the best,
Steve
the Telerik team
I was referring to the -E switch during the aspnet_regsql process (which I agree shouldn't matter but it is one of the only variances between us I can think of). I also appreciate the inability to reproduce it with the supplied project so I'm trying to see if I too cannot recreate it.
I have put the solution up to Azure (so in effect yes a different machine) with the same loading results. That said the difficulty is either within my SQL db (as we are investigating / comparing the provided sample) or the Telerik WCF service.
I have tried an alternate vendor's SL reporting solution (both locally and in Azure) that leverages a similar WCF service and do not experience the failure which leads me to lean toward the Telerik service as the culprit but certainly would stipulate it is too early to make such a charge. I would think at the core both services are most likely identical in their implementation.
I will be sure to provide as much detail as possible.
Thanks for your continued good will and effort.
I'm just throwing something 'at the wall to see if it sticks here'. I bound a report to a SQL sproc that requires a parameter. (I'm referencing the larger database with which I'm having an issue).
The report view initially shows "Rendering" then moves to a request for the parameter, which it accepts. I take this to mean all connection strings involved are functioning properly. Would you agree with this assertion? If there were a string construction issue it should / would have fired before this point (e.g. login credential failure, etc.)
After supplying the parameter for the query, the screen briefly shows another "Rendering" notice then moves to the "Loading page" notice which never completes. I'm hoping that by giving you the segments we can have a better idea of where to look.
I'm also trying to recreate the condition as previously discussed. As I don't know where this issue lies it is a bit of a challange.
Hi Steve,
Some progress. Please know that I understand your previous statement of not supporting what Microsoft does not officially support in respect to SQL Azure and SessionState / ASP authentication.
I removed all of these related components from the larger database project and brought it back to a standard version (using the aspnet_regsql tool). After a bit of code rework and testing, the report rendered and loaded fine. My next step was to add the SessionState into the SQL db. This too was successful. Then I moved to the role providers, etc. to my SQL db. Again no issues.
I then started down the road of configuration(s) necessary for SQL Azure as is my specific need. What I discovered was that the problem I was experiencing rested in the Application Service Options. The original workaround I used caused the hang I have been experiencing. I don't quite understand why your WCF service is so attached to these other processes and / or reliant on them, but apparently there is some interaction that exists.
The positive news is that there is a slightly newer workaround that I'll reference here in the spirit of really trying to help expand the audience of Telerik adopters. It really seems to be a fantastic SL reporting solution, albeit a little frustrating at times. Couple that with the fantastic support from folks like yourself (and the balance of Telerik support I've had the fortune of interacting with) and there really is no better solution in my view.
Here is a link to the code that I found successful. If you prefer this information not to be / remain public please feel free to edit it as you see fit. I do believe that getting the word out that Reporting can work with SQL Azure and custom SessionState is quite valuable.
[bad URL deleted - correct URL follows - Edit 6/22/11]
This all said, my specific project now compiles and runs without issue within the Azure Emulator. I am having a bit of difficulty testing it up on actual Azure but I'll spend some time before I trouble you further.
Thanks and regards,
Mark
We're glad you're up and running and thanks for the kind words about the product and support - much appreciated. I had suspicion that this is Azure related and when I mentioned testing on another machine I meant exactly that - testing on another 'normal' non Azure machine, as the exception you receive seems common for Azure.
Honestly the whole "I then started .." paragraph is a bit unclear as you have not mention what are the Application Service Options you have used, what was the "original" workaround and in fact how did a missing defaultDocument attribute caused an InvalidCastException.
If you really want to help others that might encounter similar problems, please elaborate on the causes for the problem and how the last thing serves as a solution.
All the best,
Steve
the Telerik team
Thanks for your reply. Please know that I'm far from up and running, it only works within the emulator at this point and fails within Azure. I am hopeful, however, that this too will be remedied. I'm experiencing a "not found" which I'm believe to be service related and am working diligently in that direction.
In respect to your request for clarity:
The application service options was -A all as per the aspnet_regsql utility. I did not iterate through each individual option so I cannot give more detail there.
I made no reference to "defaultDocument" so I am unsure as to what you mean.
The original workaround was that provided here (which I left out as to prevent an attempt that didn't succeed)
http://support.microsoft.com/kb/2006191
If I can provide more for your or other's uses please advise and I'm happy to share.
Kind regards,
Mark
You provided a link to this MSDN thread (http://social.msdn.microsoft.com/Forums/en-US/windowsazure/thread/8a354a27-cd32-46f8-aa43-85676a0e20da/) in your previous post, which led me thinking that this was the solution you refer to.
Greetings,
Steve
the Telerik team
Thank you. This was a copy / paste oversight. Must have been in cache. I'll update the post with the correct link.
Mark