Printing WCF - network printing issues [duplicate] - c#

I get the error mentioned when printing to a network printer.
The error does not occur when run under XP/Win2003, in a WinForm app or when a local printer is used.
The error does only occur when run as a Windows Service under Vista/Win7/Win2008 and printing to a network printer.
The Windows service runs under a network user that has access to the network printer. Before I print I check if the printername (including network path) is ok by looping through the available printers.
How can this be solved?

Solved by adding the printer to the SYSTEM user via a registry hack as described in the Microsoft doc: http://support.microsoft.com/kb/184291/en-us.

For anyone that stumbles across this issue in the future.
Double check that your Printer Name is correct as it could also be the reason you might be getting this error.

In my case we got same error for windows 10 os client computers.
I think the error is related users and their permissions.
After making the client computers to our company's domain the error was fixed.

Related

ASP.NET Web service generate DUPLICATE print jobs

I am develop a ASP.NET (SOAP) web service for print KOT/BOT print outs . I am using "PrintDocument" class for handle print jobs and the printer is Epson TM U220 network printer. The problem is when calling the print web method sometimes its generate DUPLICATE print outs. But according to my system logs, from the web method call print function only onetime, but from the Printer (Epson TM U220) generate same print out twice. Also this not happening every time. We are also unable figure out in which point this issue is occur.
Also this problem not occurring in our office testing environment. This happening our one client site only. Customer complain time to time, system generate DUPLICATE KOT/BOT printouts. And also their not using dedicated server PC for the IIS server and SQL server database. Their using standard shared PC for system. So is this a problem of the web service, IIS server or the Hardware (System PC or LAN Network communication between PC and the Printer)?
By the way is this AutoCutter or not? Epson has a "Serial emulation driver" that makes a USB printer act like it's on a real serial port. Then you can use direct-to-port in Campground Master, set up as a serial printer and test it whether its keep hapenning duplicate printing. but you might need to use service to talk to port in the destination computer (local port printing) we did sometime when we had simillar issue.May be this help to you

How do I make Windows Server 2012 R2 reckognize installed printer

I have a web forms application that creates a PDF and sends it to the client. It was all well and dandy until I uploaded the aplication to Windows Server 2012 R2. The problem might be some printer settings on the server (this is my first time working with a server).
The problem is Server 2012 doesn't support Windows Print to PDF, which I used on local machine and it worked great.
I gave a shot to CutePDF Writer: installed it and set it to default printer in Printers and devices. When I run the application, I get the following error:
System.Drawing.Printing.InvalidPrinterException: No printers are installed
I tried this and it generates the PDF but fails and I get an error when I try to open the PDF:
PrintDocument.PrinterSettings.PrinterName = "CutePDF Writer";
This line returns "true":
PrintDocument.PrinterSettings.IsDefaultPrinter
while this line returns "Default printer is not set.":
PrintDocument.PrinterSettings.PrinterName
I gave a shot with this, but returns "false":
Setting the default Printer for windows using c#
Please help!
The answer is trying a different approach. I shouldn't have tried working with the virtual printer (i haven't found a way to make it work).
To create a PDF from code, the best way is using iTextSharp.dll. With that you need a handful of code. Yes, I had to implement the report-creating and printing logic all over again, but it was actually easyer than the previous approach. iText is pretty straightforward and easy to use!

Capture print errors with System.Drawing.Printing.PrintDocument

The application my team is working on is developed using WPF & ,NET 4.0. The application also communicates with thermal printer connected to PC (like the ones used in malls, but its not a POS system). We only have 1 printer connected to the PC.
The application connect to printer and the output is often successful without any issues and parallel we save the data into the DB (SQL Server 2008 and going to SQL Server 2012).
On a very rare occasions the printout is not available but the data is saved to DB.
Is there any way to check or capture the printer related issue when we face this type of problem?
Thanks in advance.
Please Check whether your drivers are up to date.
And use debugging to check whether an error occurs when executing the code.
for this you can use try catch blocks which throws exceptions.

Network printing with window service

I have a friend who did the same thing with window form.
What I need is to make this to a window service.
The Window service program (printing controller service) will be used as a central printer controller.
Depending on the condition, I will send the printing job to different printer on the network (the printer is installed on USB).
It is already possible to do a test print, but when I list down the installed printers, these network printers are not listed.
But in my friend's program, all he need to do is to set the printer name to the ip address of the machine, and for that machine, just make sure that it is set to the default printer.
Once my friend set the ipaddress and trigger print, it will be printed to the correct printer. But for my case, the window service already did not list down the network printers, it will not print if printer name is wrong.
For my window service, I'm using Local System.
heard about creating a local port with the relevant IP address of the printer, but have yet to manage to test.
Hope that someone is able to give some guidance
Printing from a windows service is not recommended. Windows service runs in background and have no UI.
You can look into:
Print html document from Windows Service in C# without print dialog
EDIT
"For my window service, I'm using
Local System."
I guess you need to use a different account for your service,( domain account) so that you can access network resources.
Have sort of gave up on using window service, as when I log down the printers my computer can access, it will only show only those installed locally, those network printers are not recognized somehow.
Tried with standard TCP/IP port, have no problems setting up, but unable to even do a test print.
Decided to trade off by using window form, setting the default printer according to the mapping and issue a print command. Tested and it worked. This way, the user will only need to login the computer each day, but the advantage is that there will be no issue for the need of additional settings with regards to permission and access rights

Access To Message Queue System Denied Windows 7 Reading Windows 2003 - Windows 2008

I have an application that reads/writes from/to message queues on remote application servers. The clients usually run on machines outside of the servers' domains/forests with no trust setup.
In Windows XP this was no problem, but with the introduction of Windows 7 it stopped working.
After some research I found the suggested Registry tweak for the server (the NewRemoteReadServerAllowNoneSecurityClient DWORD in HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\MSMQ\Parameters\Security fix) and implemented that, but the software still throws an exception that access was denied to the Message Queuing system.
The message queuing system on our test server is wide open, with full control for both the EVERYONE and ANONYMOUS LOGIN accounts.
What am I missing?
I've been dealing with Microsoft support for a little over a week and they have confirmed that this is a bug in Windows 7 and in Windows Server 2008. I'll come back and add more details about when they expect a fix or workaround when I have that information, but for the time-being it appears that this is simply a bug and unworkable.
Try these blog posts:
http://blogs.msdn.com/b/johnbreakwell/archive/2010/03/24/understanding-how-msmq-security-blocks-rpc-traffic.aspx
http://blogs.msdn.com/b/johnbreakwell/archive/2008/06/27/cross-forest-msmq-you-need-to-be-trusting.aspx
http://blogs.msdn.com/b/johnbreakwell/archive/2008/04/29/clear-the-way-msmq-coming-through.aspx
http://blogs.msdn.com/b/johnbreakwell/archive/2008/02/14/how-do-i-send-msmq-messages-between-domains.aspx
Cheers
John Breakwell
Plumbersmate.EU
Could you clarify if you are having problems sending or receiving?
Sending and receiving use different network protocols and problems are resolved with completely different approaches.
As you mention that the application throws an exception then I will assume you get Access Denied on Remote Read operations only.
It sounds like the NewRemoteReadServerAllowNoneSecurityClient problem. You wrote "Thus far I've added the necessary DWORD key/values in the registry, rebooted the server," - which machine(s) did you change the setting on?
Cheers
John Breakwell

Categories

Resources