Welcome Guest! To enable all features, please Login or Register.

Notification

Icon
Error

Options
View
Last Go to last post Unread Go to first unread post
#1 Posted : Tuesday, December 2, 2008 7:35:23 AM(UTC)

Travis  
Travis

Groups: Registered, Tech Support
Posts: 207

Was thanked: 3 time(s) in 3 post(s)

Issue:
I have placed the ePrintCom class in a Windows Service Application. With a OEM_NORMAL printer installed, I connect to it in the service using set_EnableSaveStatusEvent(PRINTER_NAME, true) and handle the event. I also do this for the JobInfo event. In the events I write to a log file indicating which event was fired. I also write to the log file when the service first starts to ensure there is not a security permission preventing me from writing to the log file. I next print a test page from the OEM_NORMAL printer driver. Nothing new is written to the log file indicating that the JobInfoEvent or the SaveStatusEvent were fired. When running the application as a Windows Form application it works great.

Resolution: The application where you are printing from and the service must be loaded under the same identity. Because we have a singleton COM server if they are loaded in different identities you will have two COM objects loaded, one for the application and one for the service. Each one will be standalone and can not communicate with the other. To fix this issue you need to do the following:

1 – Browse to Administrative Tools | Component Services and access Computers | My Computer | DCOM Config | LPCMG. Use the Properties page and the Identity tab to set the identity to the interactive user. It is best to create a user specifically for your service.When you do this only one instance of our singleton com object will be created.
2 - The other part is a security issue. To solve this:
a. Click Start, click Run, type DCOMCNFG, and then click OK.
b. In the Component Services dialog box, expand Component Services, expand Computers, and then right-click My Computer and click Properties.
c. In the My Computer Properties dialog box, click the Default Properties tab.
d. Set Default Authentication to None.

Since this is a service and will probably reside on a server, you may not want to disable the security for COM on the entire machine. Here is an excerpt from MSDN about what we have asked you to modify.

*******
Setting Machine-Wide Default Authentication Level
The authentication level is used to tell COM at what level you want the client to be authenticated. These levels offer various levels of protection, from no protection to full encryption. To enable security for a machine, you need to choose an authentication level other than None.
http://msdn.microsoft.com/en-us/library/ms690141(VS.85).aspx
*******

If this is not an option for you, you can also change the security setting for a specific user using CoInitializeSecurity. You can find more information about this function here:
http://msdn.microsoft.com/en-us/library/ms693736(VS.85).aspx
Travis Montgomery
Senior Sales Engineer
LEAD Logo
 

Try the latest version of LEADTOOLS for free for 60 days by downloading the evaluation: https://www.leadtools.com/downloads

Wanna join the discussion? Login to your LEADTOOLS Support accountor Register a new forum account.

You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.

Powered by YAF.NET | YAF.NET © 2003-2024, Yet Another Forum.NET
This page was generated in 0.058 seconds.