We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

Error when tryinmg to Read RDLC from Server side


I have an issue, if I am trying to read an RDLC to a byte array through a domain service and then convert the bytes back to a stream I am getting an error saying it can't find part of the report. But if I reference the report directly in the silver-light per the example it works.

Here is the code:
Option Compare Binary
Option Infer On
Option Strict On
Option Explicit On
Imports System
Imports System.Collections.Generic
Imports System.ComponentModel
Imports System.ComponentModel.DataAnnotations
Imports System.Linq
Imports System.ServiceModel.DomainServices.Hosting
Imports System.ServiceModel.DomainServices.Server
Imports System.IO
Imports FileFunctions.FileFunctions
'TODO: Create methods containing your application logic.
<EnableClientAccess()>  _
Public Class TestReportServer
    Inherits DomainService
    Private Function GetServerRootPath() As String
        Dim r As String = HttpContext.Current.Server.MapPath("..")
        If r.EndsWith("\") = False Then r &= "\"
        Return r
    End Function
    Public Function ReportTest() As String
        Dim r As String = GetServerRootPath() & "Reports\TestReport1.rdlc"
        Return r
    End Function
    Public Function Getreport() As Byte()
        Dim b As Byte()
        Dim ff As New FileFunctions.FileFunctions
        b = ff.ReadFileToByte(GetServerRootPath() & "Reports\TestReport1.rdlc")
        Return b
    End Function
End Class

Imports System.ServiceModel.DomainServices.Client Imports System.IO Partial Public Class MainPage     Inherits UserControl     Dim test As New ReportApp.ReportTest.TestReportServer     Public Sub New()         InitializeComponent()     End Sub     Private Sub MainPage_Loaded(sender As Object, e As System.Windows.RoutedEventArgsHandles Me.Loaded         'test.ReportTest(AddressOf GetTest, Nothing)         test.Getreport(AddressOf DisplayReort, Nothing)             End Sub     Private Sub GetTest(e As InvokeOperation(Of String))         MessageBox.Show(e.Value)     End Sub     Private Sub DisplayReort(e As InvokeOperation(Of Byte()))         Dim b As Byte()         b = e.Value         'MessageBox.Show(b.Length.ToString)         's.Write(b, 0, b.Length)         'MessageBox.Show(s.Length.ToString)         's = Application.GetResourceStream(New Uri("BarChartDemo;component/TestReport1.rdlc", UriKind.Relative)).Stream         Dim rdlStream As Stream = Application.GetResourceStream(New Uri("ReportApp;component/TestReport1.rdlc"UriKind.Relative)).Stream         Dim rdlstream1 As Stream         rdlstream1 = New MemoryStream()         rdlstream1.Write(b, 0, b.Length)         Try             ReportViewer1.LoadReport(rdlStream)         Catch ex As Exception             MessageBox.Show(ex.ToString)         End Try         ReportViewer1.RefreshReport()         'MessageBox.Show(b.Length)     End Sub
Is there any diffrence between stream and
Application.GetResourceStream in there encoding.

I would like to keep the RDLC files on the server and read them in as a byte array and then reconstitute the stream.

Any help would be appreciated.

1 Reply

AS Anandakumar S Syncfusion Team October 2, 2013 02:03 PM UTC

Hi Darren Hunnter,


Thanks for using Syncfusion Products.


Please follow up the incident #113845 for updates regarding this query.


Please let us know if you have any questions.



Anandakumar S

Live Chat Icon For mobile
Up arrow icon