我正在拔头发。我接管了一个现有代码如下的项目:
'Try
Dim rs As New webreportexecution2005.ReportExecutionService()
rs.Credentials = New NetworkCredential("auser", "******", "")
'rs.Url = "http://companyweb.com/reportserver/ReportExecution2005.asmx"
ReportName = Replace(ReportName, "BuildingTabStackingFloorSumNewCust7", "BuildingTabStackingFloorSumNewCust3")
' Render arguments
Dim result As Byte() = Nothing
Dim reportPath As String = "/CompanyFolder/" + ReportName
Dim format As String = "PDF"
Dim historyID As String = Nothing
Dim devInfo As String = "False"
Dim intNumParams As Integer = 0
If Not FloorIDs = "" Then
intNumParams = 1
End If
If ReportName.EndsWith("NoBreaks") And FloorIDs = "" Then
intNumParams = intNumParams + 1
End If
Dim param(intNumParams) As webreportexecution2005.ParameterValue
param(0) = New webreportexecution2005.ParameterValue
param(0).Name = ParameterName
param(0).Value = ParameterValue
'if combined building and floor report, need to add the floor ids
If Not FloorIDs = "" Then
param(1) = New webreportexecution2005.ParameterValue
param(1).Name = "FloorIDs"
param(1).Value = FloorIDs
End If
If ReportName.EndsWith("NoBreaks") And FloorIDs = "" Then
param(intNumParams) = New webreportexecution2005.ParameterValue
param(intNumParams).Name = "PropertyName"
param(intNumParams).Value = Session("PropertyName")
End If
Dim credentials As DataSourceCredentials() = Nothing
Dim showHideToggle As String = Nothing
Dim encoding As String = ""
Dim mimeType As String = ""
Dim warnings As webreportexecution2005.Warning() = Nothing
Dim reportHistoryParameters As ParameterValue() = Nothing
Dim streamIDs As String() = Nothing
Dim execInfo As New webreportexecution2005.ExecutionInfo
Dim execHeader As New webreportexecution2005.ExecutionHeader()
Dim SessionId As String
Dim extension As String = ""
rs.ExecutionHeaderValue = execHeader
rs.Timeout = 10000000
execInfo = rs.LoadReport(reportPath, historyID)
rs.SetExecutionParameters(param, "en-us")
SessionId = rs.ExecutionHeaderValue.ExecutionID
result = rs.Render(format, devInfo, extension, _
encoding, mimeType, warnings, streamIDs)
Response.ClearContent()
Response.ClearHeaders()
Response.Clear()
Response.AppendHeader("content-length", result.Length)
Response.ContentType = "application/pdf"
Response.BinaryWrite(result)
Response.End()
Response.Flush()
Response.Close()
在我的本地机器上,一切似乎都很好。加载一个弹出窗口,页面正确生成 PDF 报告。当我将代码发布到服务器时,事情并不顺利。相反,我收到了这个:
连接尝试失败,因为连接方在一段时间后没有正确响应,或者连接失败,因为连接的主机没有响应 74.205.99.209:80 源错误: 第 456 行: 第 457 行:execInfo = rs.LoadReport(reportPath, historyID)
我似乎认为手头的问题是一些配置问题,所以这里是详细信息:
视窗服务器 2008
微软 SQL 2008
SSRS 2008
IIS 7、ASP.Net 4.0
应用程序池 4.0,集成,用户 = NetworkService