I have a hosted service inside a Windows Service, this service is in charge of printing certain info I send.
So while debugging the error won’t happen, I have to start my VS as an Administrator.
But in Production when I call .Print() I get the message “The system cannot find the file specified” and my stacktrace says:
at System.Windows.Forms.PrintControllerWithStatusDialog.OnStartPrint(PrintDocument document, PrintEventArgs e)
at System.Drawing.Printing.PrintController.Print(PrintDocument document)
at System.Drawing.Printing.PrintDocument.Print()
So far from what I have read is this is caused by a permission issue.
I already put my Windows Service as a Full Trust on its properties. I also added a manifest file on the assembly that is hosting the service.
The printer is valid and I’m able to print from any other program(Word,Excel). I also checked “Allow to interact with the desktop” and restarted the service.
Any ideas?
Are you specifying an account on the service’s LogOn tab? You probably need to provide an account that can access the printer normally. More details in our Windows Services FAQ.