Asp.net 获得;未知错误“;尝试在生产计算机上而不是在开发计算机上访问报表服务器时

Asp.net 获得;未知错误“;尝试在生产计算机上而不是在开发计算机上访问报表服务器时,asp.net,vb.net,visual-studio-2010,iis-7,ssrs-2008,Asp.net,Vb.net,Visual Studio 2010,Iis 7,Ssrs 2008,我在Visual Studio 2010中使用VB.NET、SSRS和SQL Server 2008 R2开发了一个ASP.NET 4.0应用程序。应用程序中有一个页面,它收集用户的输入,并将其用作参数,从SQL Server数据库获取数据,然后将数据放入SSRS报告,然后转换为PDF文件。这一切在我的开发机器上都可以正常工作,但在服务器上出错,特别是当它尝试对ServerReport引擎执行任何操作时。除了能够从我的开发机器上打开报表之外,我还可以直接在报表管理器中打开它。当我试图从生产机器打

我在Visual Studio 2010中使用VB.NET、SSRS和SQL Server 2008 R2开发了一个ASP.NET 4.0应用程序。应用程序中有一个页面,它收集用户的输入,并将其用作参数,从SQL Server数据库获取数据,然后将数据放入SSRS报告,然后转换为PDF文件。这一切在我的开发机器上都可以正常工作,但在服务器上出错,特别是当它尝试对ServerReport引擎执行任何操作时。除了能够从我的开发机器上打开报表之外,我还可以直接在报表管理器中打开它。当我试图从生产机器打开报告时,报告没有打开,错误由页面左下角的黄色三角形指示,双击该三角形可打开此消息

`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`
生产计算机运行Windows 2003和IIS 6 开发计算机运行Windows7和IIS7 这两台计算机都可以访问运行Windows Server 2008 R2标准的VMware虚拟服务器上的SQL Server和报表服务器

我查看了应用程序运行服务器上的事件日志,但没有找到任何关于实际错误的线索。我还查看了位于C:\Program Files\Microsoft SQL server\MSRS10\U 50.MSSQLSERVER\Reporting Services\LogFiles的报表服务器上的日志文件。当我在我的开发机器上运行应用程序时,会打开报告,并在日志中添加以下行:“library!ReportServer_0-30!1614!11/27/2012-20:18:54::I INFO:RenderForNewSession(“/RecordedOnlyIncidents/Reports/AllIncidentsWithParameters”)。如果我随后更改了开发机器上的代码,指定了一个无效路径,因此出现了错误,那么仍然有一个条目指定了错误。 “library!ReportServer_0-30!1674!11/27/2012-18:30:19::e错误:抛出Microsoft.ReportingServices.Diagnostics.Utilities.InvalidTempathException:,Microsoft.ReportingServices.Diagnostics.Utilities.InvalidTempathException:项'/ReportViewer.aspx?/RecordedOnlyIncidents/Reports/AllIncidentsWithParameters'的路径无效。完整的路径长度必须小于260个字符;其他限制也适用。如果报表服务器处于本机模式,则路径必须以斜杠开头。;“但是,如果我在服务器上运行应用程序,并且收到错误,则日志中没有条目,因此我假设甚至没有尝试访问报表服务器

我的代码如下:

`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)`
但是,我也尝试过使用不带参数的报告,然后该行出现错误:

`r.SetParameters(parameters)`
`Dim reportOutput As Byte() = r.Render("PDF", Nothing, mimeType, encoding, extension, streamids, warnings)`

如有任何建议,将不胜感激

是否应该传递正确的扩展参数。还要检查您是否对网站的根文件夹具有写入权限

我们做了类似的事情:

ReportViewer1.ServerReport.Render(exportFormat, Nothing, mimeType, encoding, exportFormat, streams, warnings)

我找到了答案,服务器上安装了错误版本的报表查看器。

欢迎使用。希望看到您在学习该系统的过程中做出更多贡献。您好,谢谢您的回复。应用程序已设置为在我指定的帐户下运行,并且该帐户和我的帐户都具有该网站的权限。我不认为这是一个权限问题,因为该应用程序同时在开发和生产机器上运行。唯一的问题是当试图在生产机器上打开报告时。老实说,关于你的其他建议,我复制了在web上找到的代码,我遇到的所有示例都将扩展参数设置为nothing。我还能放什么?如果这就是问题所在,那么它不会也出现在开发机器上吗?我找到了答案,服务器上安装了错误版本的报表查看器。