Kūrosh
Kūrosh

Reputation: 452

problem with direct print stimulsoft report on printers in local iis

I have an asp.net core web API, I want to print reports directly to the local printer in Stimulsoft Report (without preview) when call my api, my code is :

StiReport rpt = new StiReport() { UseProgressInThread = false };
rpt.Load(PrintTemplatePath);
rpt.RegBusinessObject("MyData", newData);
rpt.Print(false, new System.Drawing.Printing.PrinterSettings() { Copies = printCount, PrinterName = myPrinterName })

Everything is ok when debugging it on Visual Studio IIS Express, but when I publish it to localhost IIS, the bellow error occurred on rpt.Print(.....) line

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.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.

Upvotes: 0

Views: 88

Answers (1)

Jalpa Panchal
Jalpa Panchal

Reputation: 12749

The error you’re getting because the IIS worker process have limited permission for printer access or any desktop interaction. This limitation is due to security restrictions, as applications running under IIS typically operate in a non-interactive, restricted mode.

To achive your requiremnet you could try to follow below sugegstion:

  1. Run the iis application pool under the user identity which has enoght permission to access the printer

  2. You could try using client-side printing. by this way allows direct interaction with the local printer from the user’s browser.

Upvotes: 0

Related Questions