Take the 2-minute tour ×
Database Administrators Stack Exchange is a question and answer site for database professionals who wish to improve their database skills and learn from others in the community. It's 100% free, no registration required.

I have an asp.net 4.0 application with a button that opens a SSRS report. This works fine on my development machine and I can open the report directly with report manager but when I try to access the report on the production machine I get this error

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

I've searched the web for a solution and have found a half a dozen but none have worked for me. Here is my code:

    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)

Any suggestions would be greatly appreciated.

share|improve this question

closed as too localized by jcolebrand Dec 20 '12 at 22:06

This question is unlikely to help any future visitors; it is only relevant to a small geographic area, a specific moment in time, or an extraordinarily narrow situation that is not generally applicable to the worldwide audience of the internet. For help making this question more broadly applicable, visit the help center.If this question can be reworded to fit the rules in the help center, please edit the question.

    
When you are testing it on your local machine, is the aspx pointing to a report also on the local machine or is it routing to the production SSRS box? What if you display the report instead of rendering as PDF, does it also throw a 500? –  billinkc Dec 13 '12 at 18:00
    
Hello and thanks for your comments. The development and production machines both use the same report server and report. It doesn't get to the point where the code should render it as a PDF. The error occurs when it tries to set the parameters. –  user1788680 Dec 13 '12 at 23:16
add comment

1 Answer 1

I found the answer, the wrong version of the Report Viewer was installed on the server.

share|improve this answer
add comment

Not the answer you're looking for? Browse other questions tagged or ask your own question.