Error printing from asp.net process to invalid printer

Stimulsoft Reports.WEB discussion
Post Reply
hfirst
Posts: 25
Joined: Mon Apr 20, 2015 2:11 pm

Error printing from asp.net process to invalid printer

Post by hfirst »

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?
HighAley
Posts: 8430
Joined: Wed Jun 08, 2011 7:40 am
Location: Stimulsoft Office

Re: Error printing from asp.net process to invalid printer

Post by HighAley »

Hello.

Could you specify how do you print the reports?
It seems that your message is corrupted.

Thank you.
hfirst
Posts: 25
Joined: Mon Apr 20, 2015 2:11 pm

Re: Error printing from asp.net process to invalid printer

Post by hfirst »

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.
HighAley
Posts: 8430
Joined: Wed Jun 08, 2011 7:40 am
Location: Stimulsoft Office

Re: Error printing from asp.net process to invalid printer

Post by HighAley »

Hello.

There is an Exception occurs while printing.
Please, try to set next property:

Code: Select all

StiOptions.Engine.HideExceptions = true;
Also you could use next code for logging:

Code: Select all

Stimulsoft.Report.StiLogService.LogEnabled = true;
StiLogService service = StiConfig.Services.GetService(typeof(StiLogService)) as StiLogService;
service.LogPath = "Report.log"; // Path and filename
Thank you.
Post Reply