I have an application that I'm working on and I allow the user to select a printer to use as their printer while printing forms from the application. I'm using .NET 2.0
In the settings screen, I call
System.Drawing.Printing.PrinterSettings.InstalledPrinters
to get the list of available printers.
On a client's machine, the property throws an exception:
System.ComponentModel.Win32Exception: The RPC server is unavailable
The client is reporting that windows shows his printer as 'ready', and the client can print test pages from the printer. But, I have not been able to reproduce this issue locally and I'm running out of ideas. Does anyone have any ideas what could cause this issue? Any ideas or directions to look would be helpful. Thanks
-
Could this have anything to do with Network Printers? RPC is Remote Procedure Call, perhaps this is used for detecting installed network-printers?
After some googling on the error:
The InstalledPrinters uses WMI to look for printers. WMI on its turn uses RPC.
Having WMI return an error of your kind could mean the following:
- MSDN Support
- It could have something to do with accounts: check local/network/system account for your application and try running your application under a registered account (user+password)
- Also check forum post, solving this for an ASP.NET application: link
And a useful WMI resource for your problem.
Richard R : The printers on the client machine are connected via USB. -
Either the RPC service is off or Windows Firewall is blocking it.
-
If you can print, most likely a security issue. Otherwise I would have voted "dead spooler service" but more likely your app doesn't have the rights to communicate with the spooler service...
Richard R : Yea, it was a dead spooler service. Installing the printer drivers was causing the printer to spooler service to die. I ended up pushing this issue onto the Printer Manufacturer after I isolated this exception to a specific installation of the printer as opposed to all of them. -
I had a similar problem using PrinterSettings.InstalledPrinters and the cause was that the application was running with "Partial Trust" permissions.
In Visual Studio, went to Project Properties\Security and selected "This is a full trust application".
I'm not sure if this is going to help you but did it for me.
-
Another possibility is also that the PrintSpooler service has been set to Disabled
0 comments:
Post a Comment