Was debugging a new database, and printing wasn't working, then realized it was because I was sending the reports to an invalid printer. The printing is being executed from a background worker in an asp.net website to a server installed printer.
The error I am getting when I call print is:
Additional information: Showing a modal dialog box or form when the application is not running in UserInteractive mode is not a valid operation. Specify the ServiceNotification or DefaultDesktopOnly style to display a notification from a service application.
It would seem internally in your code you are trying to show a messagebox or something?. Is it possible for you to better support running guiless and just bubble up the real exception?
Error printing from asp.net process to invalid printer
Re: Error printing from asp.net process to invalid printer
Hello.
Could you specify how do you print the reports?
It seems that your message is corrupted.
Thank you.
Could you specify how do you print the reports?
It seems that your message is corrupted.
Thank you.
Re: Error printing from asp.net process to invalid printer
A first chance exception of type 'System.InvalidOperationException' occurred in Stimulsoft.Report.dll
Additional information: Showing a modal dialog box or form when the application is not running in UserInteractive mode is not a valid operation. Specify the ServiceNotification or DefaultDesktopOnly style to display a notification from a service application.
CallStack:
at System.Windows.Forms.Form.ShowDialog(IWin32Window owner)
at Stimulsoft.Base.StiExceptionProvider.Show(Exception exception)
at Stimulsoft.Report.Print.StiPrintProvider.Print(StiReport report, Boolean showPrintDialog, Int32 fromPage, Int32 toPage, Int16 copies, PrinterSettings printerSettings)
at Stimulsoft.Report.StiReport.Print(Boolean showPrintDialog, Int32 fromPage, Int32 toPage, Int16 copies, PrinterSettings printerSettings)
at Stimulsoft.Report.StiReport.Print(Boolean showPrintDialog, PrinterSettings printerSettings)
Win 7-64, C#, 2016.1, IIS, asp.net 4.6.1
To duplicate, from within an asp.net background task started using HostingEnvironment.QueueBackgroundWorkItem, call report.Print(false, printerSettings); giving it an invalid printer name.
Additional information: Showing a modal dialog box or form when the application is not running in UserInteractive mode is not a valid operation. Specify the ServiceNotification or DefaultDesktopOnly style to display a notification from a service application.
CallStack:
at System.Windows.Forms.Form.ShowDialog(IWin32Window owner)
at Stimulsoft.Base.StiExceptionProvider.Show(Exception exception)
at Stimulsoft.Report.Print.StiPrintProvider.Print(StiReport report, Boolean showPrintDialog, Int32 fromPage, Int32 toPage, Int16 copies, PrinterSettings printerSettings)
at Stimulsoft.Report.StiReport.Print(Boolean showPrintDialog, Int32 fromPage, Int32 toPage, Int16 copies, PrinterSettings printerSettings)
at Stimulsoft.Report.StiReport.Print(Boolean showPrintDialog, PrinterSettings printerSettings)
Win 7-64, C#, 2016.1, IIS, asp.net 4.6.1
To duplicate, from within an asp.net background task started using HostingEnvironment.QueueBackgroundWorkItem, call report.Print(false, printerSettings); giving it an invalid printer name.
Re: Error printing from asp.net process to invalid printer
Hello.
There is an Exception occurs while printing.
Please, try to set next property:
Also you could use next code for logging:
Thank you.
There is an Exception occurs while printing.
Please, try to set next property:
Code: Select all
StiOptions.Engine.HideExceptions = true;
Code: Select all
Stimulsoft.Report.StiLogService.LogEnabled = true;
StiLogService service = StiConfig.Services.GetService(typeof(StiLogService)) as StiLogService;
service.LogPath = "Report.log"; // Path and filename