Web服务呈现SSRS报告连接失败

时间:2013-06-14 15:37:21

标签: .net sql-server wcf reporting-services

我正把头发拉出来。我接管了一个现有代码如下的项目:


'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报告。当我将代码发布到服务器时,事情进展不顺利。相反,我收到了这个:

A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond 74.205.99.209:80


Source Error: 


Line 456:
Line 457:        execInfo = rs.LoadReport(reportPath, historyID) 

我似乎认为手头的问题是一些配置问题,所以这里有详细信息:

Windows server 2008

MSSQL 2008

SSRS 2008

IIS 7,ASP.Net 4.0

Application Pool 4.0,Integrated,user = NetworkService

1 个答案:

答案 0 :(得分:0)

我猜错的是防火墙不允许联系SSRS主机。如果您提供凭证明确而没有进入,这可能是与联系服务本身相关的问题。在深入研究VB.NET代码之前,我会直接访问服务器并尝试访问:

http://companyweb.com/reportserver

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

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