Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
201 views
in Technique[技术] by (71.8m points)

java - How to reload printers in coldfusion without restarting service?

This is my basic understanding of how to make a printer available to use in ColdFusion.

  1. Remote into the server running CF using the account that the CF service is running under.
  2. Open the windows control panel and add the printer.
  3. Restart the CF service.

My question: is there any way to reload the printers without restarting the CF service?

This is the issue we are trying to troubleshoot. CF error detail:

Error: Printer \(server)(printerName) is not available. Available printers are: , ???, , , , 凙??, , 疠??, , .

Restarting the CF service fixes this but it seems to be happening pretty often lately. I am wondering if there is some java code to reload the printers so it can be done automatically. We are using CF9.

question from:https://stackoverflow.com/questions/21383853/how-to-reload-printers-in-coldfusion-without-restarting-service

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

To use a network printer ColdFusion is going to need to be running under a domain account that has permissions to network resources. The default user that the ColdFusion Windows Service runs under is localSystem. This user account normally has lots of permissions to the local system but no permissions on the network. The usual solution is to create a domain account for this purpose and then set the ColdFusion Windows service to run as that user in the Services Control Panel.

I recently installed a printer on my server machine, and it was detected right away without any issues. I am using CF10 on a Windows 7 64-bit system. So the following code listed my printer without any restart of the service at all:

<cfdump var="#GetPrinterInfo()#">

Hope this would help.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...