Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: ASP.NET IIS SSRS VB.NET
I have an ASP.NET 4.0 application developed in Visual Studio 2010 using VB.NET, SSRS and SQL Server 2008 R2. There is a page in the app that gathers input from the user which it uses as parameters to get data from a SQL Server database that it puts in a SSRS report that it then converts to a PDF file. This all works fine on my development machine but errors out on the server specifically when it tries to do anything in regards to the ServerReport engine. Besides being able to open the report from my development machine I can also open it directly in the report manager. When I try to open the report from the production machine the report doesn't open and the error is indicated by the yellow triangle in the lower left of the page which when double clicked opens up this message.
 
Webpage error details
User Agent: Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.1; Trident/4.0; GTB7.4; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729; Media Center PC 6.0; CMDTDF; BRI/1; .NET4.0C; InfoPath.3; .NET4.0E)
Timestamp: Sat, 1 Dec 2012 21:35:46 UTC
Message: Sys.WebForms.PageRequestManagerServerErrorException: An unknown error occurred while processing the request on the server. The status code returned from the server was: 500
Line: 2
Char: 74741
Code: 0
URI: http://intranet/webapps/TestRecordedOnlyIncidents/ScriptResource.axd?d=ZBsMSL9jIyW8I9p1LwFOBagb0X-bFxrU28WowdY5TbC9ZankzHyooPpti5W0JT6DLsOOmhf_2t5kU1g4r1F40RiMcHtiuYqff50r1VaQMwtZ9CW6zRVLnDMJYHiVvrNZ0&t=ffffffffbad362a4

 
The production machine runs Windows 2003 and IIS 6 The development machine runs Window 7 and IIS 7 Both of these machines access the SQL Server and Report Server that are on a VMware virtual server running Windows Server 2008 R2 Standard.
I've looked in the event logs on the server the app runs on but haven't found any clue as to what the actual error is. I've also looked at the log file on the report server located at C:\Program Files\Microsoft SQL Server\MSRS10_50.MSSQLSERVER\Reporting Services\LogFiles. When I run the app on my development machine the report opens and the following line is added to the log,
"library!ReportServer_0-30!1614!11/27/2012-20:18:54:: i INFO: RenderForNewSession('/RecordedOnlyIncidents/Reports/AllIncidentsWithParameters')".
If I then change the code on the development machine specifying an invalid path so that there is an error there is still an entry specifying the error. "library!ReportServer_0-30!1674!11/27/2012-18:30:19:: e ERROR: Throwing Microsoft.ReportingServices.Diagnostics.Utilities.InvalidItemPathException: , Microsoft.ReportingServices.Diagnostics.Utilities.InvalidItemPathException: The path of the item '/ReportViewer.aspx?/RecordedOnlyIncidents/Reports/AllIncidentsWithParameters' is not valid. The full path must be less than 260 characters long; other restrictions apply. If the report server is in native mode, the path must start with slash.;" However if I run the app on the server and I get the error there is no entry in the log so I assume there isn't even an attempt to access the report server.
My code is below:
 
Dim r = New ServerReport
    r.ReportServerUrl = New Uri("http://vm-intranet/ReportServer")
    r.ReportPath = "/RecordedOnlyIncidents/Reports/AllIncidentsWithParameters"
    Dim EmployeeNumber As String = IIf(txtSearchEmployeeNumber.Text = "", Nothing, txtSearchEmployeeNumber.Text)
    Dim IncidentType As String = IIf(ddlSearchIncidentType.SelectedItem.Text = "", Nothing, ddlSearchIncidentType.SelectedItem.Text)
    Dim BeginningDate As String = IIf(txtBeginningDate.Text = "", Nothing, txtBeginningDate.Text)
    Dim EndingDate As String = IIf(txtEndingDate.Text = "", Nothing, txtEndingDate.Text)
    Dim parmEmpNumEmployeeNumber As New ReportParameter("EmployeeNumber", EmployeeNumber)
    Dim parmIncidentType As New ReportParameter("IncidentType", IncidentType)
    Dim parmBeginningDate As New ReportParameter("BeginningDate", BeginningDate)
    Dim parmEndingDate As New ReportParameter("EndingDate", EndingDate)
    Dim parameters(3) As ReportParameter
    parameters(0) = parmEmpNumEmployeeNumber
    parameters(1) = parmIncidentType
    parameters(2) = parmBeginningDate
    parameters(3) = parmEndingDate
    r.SetParameters(parameters)
    Dim warnings As Warning() = Nothing
    Dim streamids As String() = Nothing
    Dim mimeType As String = Nothing
    Dim encoding As String = Nothing
    Dim extension As String = Nothing
 
    Dim reportOutput As Byte() = r.Render("PDF", Nothing, mimeType, encoding, extension, streamids, warnings)
    Dim path As String = System.AppDomain.CurrentDomain.BaseDirectory
    Dim stream As New IO.FileStream(path & "/MyReport.pdf", IO.FileMode.Create)
    stream.Write(reportOutput, 0, reportOutput.Length)
    stream.Close()
    Dim Script As String = "<script type='text/javascript'> win=window.open("""",""_blank"",""resizable=Yes,height=600"");win=win.document;win.write(""<style>body{margin:0px;}</style>"");win.write(""<title> Incidents Report</title>"");win.write(""<iframe src='MyReport.pdf' style='width:100%;height:100%;'></iframe>"");</script>"
    ScriptManager.RegisterStartupScript(Me, Me.GetType(), "OpenReport", Script, False)
End Sub
 
The error occurs on the line:
r.SetParameters(parameters)
However I've also tried using a report that did not take parameters and then the error occurs on the line:
Dim reportOutput As Byte() = r.Render("PDF", Nothing, mimeType, encoding, extension, streamids, warnings)
`Any suggestions would be greatly appreciated.
 
Any suggestions would be greatly appreciated.
Posted 13-Dec-12 5:08am
Edited 20-Dec-12 5:22am
v3
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

Have you tried restarting all the machines in this scenario and then rerunning your report.
  Permalink  
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 2

Hello and thanks for your suggestion. Actually I found the answer, the wrong version of the Report Viewer was installed on the server. I had meant to update this post but hadn't gotten to it yet. I apologize for that. Thanks again for making the effort to try and help me out.
  Permalink  

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 Zoltán Zörgő 320
1 CHill60 165
2 BillWoodruff 120
3 Peter Leow 120
4 bling 80
0 Sergey Alexandrovich Kryukov 9,423
1 OriginalGriff 6,891
2 Peter Leow 4,637
3 Zoltán Zörgő 4,304
4 CHill60 2,932


Advertise | Privacy | Mobile
Web03 | 2.8.150129.1 | Last Updated 20 Dec 2012
Copyright © CodeProject, 1999-2015
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100