VB.Net ReportExecutionService超时? [英] VB.Net ReportExecutionService Timeout?

查看:70
本文介绍了VB.Net ReportExecutionService超时?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个问题,使用此

I have a question, using this code and the problem I'm having is using the rs.Timeout = 300000 in 5 Minutes I would think it would exit sub or move on.  when running in debug I get "An exception of type 'System.Net.WebException' occurred in System.Web.Services.dll but was not handled in user code"   any suggestion on MSDN code below to work with timeout and if timeout is exceeded it does not hang preferable caught or exit sub.  thanks any information is greatly appreciated. 

Imports System
Imports System.IO
Imports System.Web.Services.Protocols
Imports myNamespace.MyReferenceName

Class Sample
    Public Shared Sub Main()
        Dim rs As New ReportExecutionService()
        rs.Credentials = System.Net.CredentialCache.DefaultCredentials
        rs.Url = "http://myserver/reportserver/ReportExecution2005.asmx"

        ' Render arguments
        Dim result As Byte() = Nothing
        Dim reportPath As String = "/AdventureWorks Sample Reports/Employee Sales Summary "
        Dim format As String = "MHTML"
        Dim historyID As String = Nothing
        Dim devInfo As String = "<DeviceInfo><Toolbar>False</Toolbar></DeviceInfo>"

        ' Prepare report parameter.
        Dim parameters(2) As ParameterValue

        parameters(0) = New ParameterValue()
        parameters(0).Name = "EmpID"
        parameters(0).Value = "288"
        parameters(1) = New ParameterValue()
        parameters(1).Name = "ReportMonth"
        parameters(1).Value = "6" ' June
        parameters(2) = New ParameterValue()
        parameters(2).Name = "ReportYear"
        parameters(2).Value = "2004"

        Dim credentials As DataSourceCredentials() = Nothing
        Dim showHideToggle As String = Nothing
        Dim encoding As String = ""
        Dim mimeType As String = ""
        Dim warnings As Warning() = Nothing
        Dim reportHistoryParameters As ParameterValue() = Nothing
        Dim streamIDs As String() = Nothing

        Dim execInfo As New ExecutionInfo
        Dim execHeader As New ExecutionHeader()
        Dim SessionId As String
        Dim extension As String = ""

        rs.Timeout = 300000

        rs.ExecutionHeaderValue = execHeader

        execInfo = rs.LoadReport(reportPath, historyID)

        rs.SetExecutionParameters(parameters, "en-us")

        SessionId = rs.ExecutionHeaderValue.ExecutionID
        Console.WriteLine("SessionID: {0}", rs.ExecutionHeaderValue.ExecutionID)


        Try
            result = rs.Render(format, devInfo, extension, _
               encoding, mimeType, warnings, streamIDs)

            execInfo = rs.GetExecutionInfo()

            Console.WriteLine("Execution date and time: {0}", execInfo.ExecutionDateTime)


        Catch e As SoapException
            Console.WriteLine(e.Detail.OuterXml)
        End Try

        ' Write the contents of the report to an MHTML file.
        Try
            Dim stream As FileStream = File.Create("report.mht", result.Length)
            Console.WriteLine("File created.")
            stream.Write(result, 0, result.Length)
            Console.WriteLine("Result written to the file.")
            stream.Close()
        Catch e As Exception
            Console.WriteLine(e.Message)
        End Try
    End Sub 'Main
End Class

更轻松地工作更聪明

推荐答案

由于您的案例没有得到帮助,因此建议您发布相同的内容以下论坛上专门讨论Web服务的问题:

Since you didn't get help on your case here, I suggest that you post the same question on the below forum that is dedicated for web services discussions:

WCF,ASMX和其他Web服务


这篇关于VB.Net ReportExecutionService超时?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆