通过rs.exe设置SSRS部署报告"限制报告处理..."性能

时间:2014-10-15 15:27:04

标签: vb.net reporting-services

任何机构都知道如何设置propeties处理选项 - >报告超时 - >将报告处理限制为以下秒数: 报告将由rs.exe实用程序部署,vb脚本作为参数? 我有vs脚本将Reports部署到RS服务器,但我找不到设置所需属性的方法名称。 我找到了方法列表http://msdn.microsoft.com/en-us/library/reportservice2010.reportingservice2010_methods.aspx 但我无法找到哪一个可以帮我设置超时。

Dim definition As [Byte]() = Nothing
Dim warnings As Warning() = Nothing
Dim rsReportsPath As String = "/" + rsFolder
Dim Is_error As Boolean

Public Sub Main()   
    rs.Credentials = System.Net.CredentialCache.DefaultCredentials
    Is_error = false

    'Create the parent folder
    Try
        rs.CreateFolder(rsFolder, "/", Nothing)
        Console.WriteLine("Parent folder created: {0}", rsFolder)

    Catch e As Exception
        Console.WriteLine(e.Message)

    End Try

    'PublishReport(reportName)
    PubReportsAndFolders(reportPath)    
End Sub



Public Sub PubReportsAndFolders(ByVal FolderToParse As String)          
        Dim fileEntries As String() = Directory.GetFiles(FolderToParse)
        ' Process the list of files found in the directory. 
        Dim fileName As String 
        For Each fileName In fileEntries
          Console.WriteLine("")
            Console.WriteLine("Report: '{0}' Begin read file '{1}'", fileName,  DateTime.Now)
            PublishReport(Path.GetFileNameWithoutExtension(fileName))
        Next    

      If Is_error = True then
        Throw New ApplicationException
      End If        
End Sub

Public Sub PublishReport(ByVal reportName As String)
    Try
        ' Open input file and read report definition        
        Dim stream As FileStream = File.OpenRead(reportPath + "\" + reportName + ".rdl")                
        definition = New [Byte](stream.Length - 1) {}
        stream.Read(definition, 0, CInt(stream.Length))
        stream.Close()      
    Catch e As IOException
        Console.WriteLine("Error: '{0}'",e.Message)
        Is_error = true
    End Try

    Try
        ' Upload the report definition to the reporting server  
        Dim properties(0) As [Property]
        Dim description As New [Property]
        description.Name = "Description"
        description.Value = "Some description"
        properties(0) = description


        warnings = rs.CreateReport(reportName, rsReportsPath, True, definition, properties)
        If Not (warnings Is Nothing) Then
            Dim warning As Warning
            For Each warning In warnings
                Console.WriteLine("Error: '{0}'",warning.Message)
            Next warning
            Is_error = true
        Else
            Console.WriteLine("Report: '{0}' published successfully with no warnings.", reportName)
        End If



        Dim dataSources As DataSource() = Nothing
        Dim updateDs As Boolean = False
        dataSources = rs.GetItemDataSources(rsReportsPath + "/" + reportName)       
        If Not (dataSources Is Nothing) Then            
            Dim ds As DataSource
            For Each ds In dataSources
                Console.WriteLine("Report: '{0}' processing datasource '{1}'.", reportName, ds.Name)
                If TypeOf ds.Item Is DataSourceDefinition Then
                    Dim definition As DataSourceDefinition = CType(ds.Item, DataSourceDefinition)

                    Console.WriteLine("Report: '{0}' updating CredentialRetrieval property of datasource '{1}'.", reportName, ds.Name)
                    definition.CredentialRetrieval = CredentialRetrievalEnum.None
                    ds.Item = definition
                    updateDs = True
                End If
            Next ds         

            If (updateDs) Then
                Console.WriteLine("Report: '{0}' posting updated datasources back to the report.", reportName, ds.Name)
                rs.SetItemDataSources(rsReportsPath + "/" + reportName, dataSources)
                Console.WriteLine("Report: '{0}' datasources' credentials updated.", reportName)
            Else
                Console.WriteLine("Report: '{0}' datasources' credentials not updated.", reportName)
            End If          
        Else
            Console.WriteLine("Report: '{0}' no datasource has been found.", reportName)
        End If

    Catch e As Exception        
        Console.WriteLine("Error: '{0}'",e.Message)
        Is_error = true
    End Try

End Sub

1 个答案:

答案 0 :(得分:0)

我在问题上找到了答案。我需要设置" ReportTimeout"属性

Dim p(0) As [Property]
p(0) = New [Property]
p(0).Name = "ReportTimeout"
p(0).Value = 1111 'value in seconds
rs.SetProperties("catalog/reportname", p)