No Printers are detected when running the site outside of Visual Studio 2013 in IIS7

I've built an application to print documents. When running the application using Visual Studio - debugging mode I could receive the list of available printers using :

PrinterSettings.InstalledPrinters

and then , I select one of them to print the document using :

PrintDocument printDocument = new PrintDocument();
printDocument.PrinterSettings.PrinterName = "Fax" ; //or any other listed printer that is returned from the method above
printDocument.PrintPage += printDocument_PrintPage;
printDocument.Print();

void printDocument_PrintPage(object sender, PrintPageEventArgs e)
{
    e.Graphics.DrawRectangle(new Pen(Color.Red,10),new Rectangle(0,0,100,100));
}

This works inside of Visual Studio, but when I migrate it to IIS 7 root folder on the same computer, it gives an error "there's no printers installed"

Note: I still can get the same list of available printers when I deploy the application to the root folder, but when Print() method is called, the web application throws the error.

I am using the namespace System.Drawing.Printing

Update : I did check the System.Printing namespace reference page, it also shows a box says :

"Classes within the System.Printing namespace are not supported for use within a Windows service or ASP.NET application or service."

Answers


I had the same issue, you could see in service how RPC (in services) is running (network service | local sytem) and put that in the application pool on IIS adance setting Identity.

I hope I could help!.


Need Your Help

No overload for 'method' matches delegates 'System.eventhandler'

c# xaml animation

I'm trying to check when one animation has finished in xaml/c# so I have used the "Completed" event which looks like

Routes issue in laravel 4

php routing routes laravel laravel-4

I am new to laravel and learning it now. I am giving following Route in routes.php file