[英]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). 我在C#中编写了一个应用程序,它通过DCOM对象写入会计系统(对象的名称是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.
当此应用程序在Windows 2003中作为Windows服务托管时,该服务无法打开DCOM对象,尽管运行该服务的用户标识具有所有必需的访问权限。
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. 我曾尝试通过DCOMCNFG调整对DCOM对象的访问权限,但似乎没有任何效果。
COM uses Windows Messages to communicate between processes. COM使用Windows消息在进程之间进行通信。 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). 尝试创建隐藏窗口(或可见窗口来测试假设)。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.