将WEB程序发布在本地IIS上测试,在打印ActiveReport报表的时候,抛出异常提示
当应用程序不是以 UserInteractive 模式运行时显示模式对话框或窗体是无效操作。请指定 ServiceNotification 或 DefaultDesktopOnly 样式,以显示服务应用程序发出的通知。 但是如果直接通过代码调试的话,打印功能又没问题,请问有没有哪位朋友知道是怎么回事啊?

解决方案 »

  1.   


    说明: 执行当前 Web 请求期间,出现未处理的异常。请检查堆栈跟踪信息,以了解有关该错误以及代码中导致错误的出处的详细信息。 异常详细信息: System.InvalidOperationException: 当应用程序不是以 UserInteractive 模式运行时显示模式对话框或窗体是无效操作。请指定 ServiceNotification 或 DefaultDesktopOnly 样式,以显示服务应用程序发出的通知。源错误: 
    行 130:                this.RptViewer.Report.ShowParameterUI = true;
    行 131:                this.RptViewer.Report.Run(false);
    行 132:                this.RptViewer.Report.Document.Print(true, false);
    行 133:            }
    行 134:            else
     源文件: D:\Project\JSL\JSL\report\ReportClientOwe.aspx.cs    行: 132 堆栈跟踪: 
    [InvalidOperationException: 当应用程序不是以 UserInteractive 模式运行时显示模式对话框或窗体是无效操作。请指定 ServiceNotification 或 DefaultDesktopOnly 样式,以显示服务应用程序发出的通知。]
       System.Windows.Forms.CommonDialog.ShowDialog(IWin32Window owner) +3103138
       System.Windows.Forms.CommonDialog.ShowDialog() +6
       DataDynamics.ActiveReports.Document.Document.Print(Boolean showPrintDialog, Boolean showPrintProgressDialog, Boolean usePrintingThread) +1175
       DataDynamics.ActiveReports.Document.Document.Print(Boolean showPrintDialog, Boolean showPrintProgressDialog) +19
       JSL.report.ReportClientOwe.ImageButton2_Click(Object sender, ImageClickEventArgs e) in D:\Project\JSL\JSL\report\ReportClientOwe.aspx.cs:132
       System.Web.UI.WebControls.ImageButton.OnClick(ImageClickEventArgs e) +105
       System.Web.UI.WebControls.ImageButton.RaisePostBackEvent(String eventArgument) +115
       System.Web.UI.WebControls.ImageButton.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) +7
       System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +11
       System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +33
       System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +5102