简体   繁体   English

无法从使用c#(Windows 2003服务器)编写的Windows服务访问DCOM对象,但可以在作为控制台应用程序托管时访问该对象

[英]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.

相关问题 无法从C#中的客户端(控制台应用程序)通过WCF服务(已通过Windows身份验证)访问SQL Server - Unable to access SQL Server from WCF service (Windows authenticated) from client (console application) in C# 在Windows Service中托管时无法访问远程对象对象 - Unable to access Remoting object members when hosting in Windows Service 在Windows Server 2003中将控制台应用程序安装为Windows服务 - installing a console application as a windows service in windows server 2003 如何从客户端应用程序访问Windows服务上托管的Web服务? - How to access a Web Service hosted on a Windows Service from a client application? 无法使用C#从Windows Service访问Outlook日历 - Unable to access outlook calender from Windows Service using c# 无法访问Windows服务中托管的WCF - Unable to access to WCF hosted in a windows service 用 c# 编写的 Windows IoT 控制台应用程序? - Windows IoT console application written in c#? 从和C#Windows应用程序进行SQL Server远程访问 - SQL server remote access from and C# windows application C#:Windows控制台应用程序到Windows服务 - C#: Windows Console Application to Windows Service 从Windows Server 2008访问Windows Server 2003共享文件夹 - Access windows server 2003 share folder from windows server 2008
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM