0

我正在拔头发。我接管了一个现有代码如下的项目:


'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

4

1 回答 1

0

我猜想最重要的是防火墙不允许联系 SSRS 主机。如果您明确提供凭据并且没有进入,则可能是与联系服务本身相关的问题。在深入了解您的 VB.NET 代码之前,我会直接访问服务器并尝试访问:

http://companyweb.com/reportserver

如果您可以作为默认管理员到达那里,请尝试在您的代码中使用该帐户(不确定是否已经存在)。我知道我过去在使用 SSRS 远程连接代码时也遇到了问题,而且几乎总是用户在此处获得权限但在此处没有权限的问题,或者是其中的一部分但不是其中的一部分。您也可以尝试将服务托管在 80 以外的端口上,这是默认端口,因为有时服务器在 Windows 防火墙中未专门打开端口 80 时会默认阻止端口 80。然后你可以进入服务器并检查防火墙。

我经常明确地将 SSRS 设置为使用 80 以外的端口。

于 2013-06-14T22:42:23.400 回答