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: Wed, 12 Dec 2012 20:03:54 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
ScriptResource.axd                                                              Line: 2
Code: 0                                                                     Char: 74741
URI: http://intranet/webapps/RecordedOnlyIncidents/ScriptResource.axd?d=GnweTchBv7S3iPh-J2y96yey3C3_pzddkEeS0GIM0GHz6A1wrAToLVysD0C0nmS_sugidnIpUa9dt3MXUvPZgTV3kdSrhNnjjikolQ4t_qbyruxeky4MDgxR-klgMjZP0&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)
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)`

```

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.