TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
mgopinath
NA
1
0
Accessing printer in c# windows service fails
Nov 8 2003 4:40 AM
I am trying to print from a .net windows service when I call the Print() method of the PrintDocument class or do anything to access the printer such as to invoke the InstalledPrinters method of the PrinterSettings class, the service throws an error. The service is currently running under a domain user account and printers are installed on the machine for that user profile. Error logged in event log: Service cannot be started. System.TypeInitializationException: The type initializer for "System.Drawing.SafeNativeMethods" threw an exception. ---> System.Runtime.InteropServices.ExternalException: Failed to create system events window thread. at Microsoft.Win32.SystemEvents.EnsureSystemEvents(Boolean requireHandle, Boolean throwOnRefusal) at Microsoft.Win32.SystemEvents.InvokeOnEventsThread(Delegate method) at System.Drawing.SafeNativeMethods.Initialize() at System.Drawing.SafeNativeMethods..cctor() --- End of inner exception stack trace --- at System.Drawing.SafeNativeMethods.EnumPrinters(Int32 flags, String name, Int32 level, IntPtr pPrinterEnum, Int32 cbBuf, Int32[] pcbNeeded, Int32[] pcReturned) at System.Drawing.Printing.PrinterSettings.get_InstalledPrinters() at TestPrintService.Service1.OnStart(String[] args) in D:\Dev Projects\...\Sandbox\dotnetservice\TestPrintService\Service1.vb:line 65 at System.ServiceProcess.ServiceBase.ServiceQueuedMainCallback(Object state) Anybody please help me to resolve the issue. Thanks in Advance. Gopinath
Reply
Answers (
0
)
Translating (using resources?)
Answer To Printing from Right To Left To Printer in VB.NET