简体   繁体   中英

Unable to access DCOM object from Windows Service written in c# (Windows 2003 server) but can access the object when hosted as a console application

I have written an application in C# that writes to an accounting system via a DCOM object (name of the object is Toolkit Object). When this application is hosted as Windows Service in Windows 2003 the service is unable to open the DCOM object although the user identity under which the service is running has all the necessary access rights.

When I host the same application using a console app it works fine.

I have tried tweaking the access rights to the DCOM object through DCOMCNFG but nothing seems to work.

COM uses Windows Messages to communicate between processes. So the first question is: Does your service have a message pump? If not, that's most likely the problem.

Try creating a hidden window (or a visible window to test the hypothesis).

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM