获取正在运行的进程中的对象信息
我有一个作为服务运行的 vb.net 应用程序。我还有另一个 Windows 应用程序作为服务接口。
简而言之,该服务会监视某些文件夹中的新文件并将它们导入到各种数据库中。在服务中,我有一个名为“importFile”的类,其中包含“FileName”和“ImportStatus”等基本属性。对于每个新的传入文件,我都会创建一个“importFile”的新实例,并将其添加到名为 myFiles 的列表对象中,该对象的类型为:List (of importFile)。
目前,在我的服务中,我将一些对象详细信息(例如 ImportStatus)写入 XML 配置文件,该文件又由服务接口应用程序读取。
我想从服务向接口公开更多信息,而通过 xml 进行通信感觉并不是最有效的方法。
我的问题是如何向界面应用程序公开活动对象,例如服务中的“myFiles”?我认为这可以通过 Process 类来完成,但到目前为止我所有的努力都失败了。
我认为解决方案可能如下所示,但我不太确定我在做什么,并且可能会很遥远:
Dim myProcess() As Process = Process.GetProcessesByName("ImportApp", ".")
Dim fileList As List (of importFile) = myProcess(0).GetObjectRef( ??????????? )
任何帮助将不胜感激,谢谢。
I have a vb.net application which runs as a service. I also have another Windows application that serves as the service interface.
In brief the service watches some folders for new files and imports them into various databases. In the service I have an class called 'importFile' containing basic properties such as 'FileName' and 'ImportStatus'. With each new incoming file I create a new instance of 'importFile' and add it to a list object called myFiles which is of the type: List (of importFile).
Currently in my service im writing a few object details (such as ImportStatus) to an XML config file which is in turn read by the service interface application.
I want to expose more information from the service to the interface, and communicating via xml doesn't feel like its the most efficient method.
My question is how do I expose live objects, such as 'myFiles' in my service to my interface application? I think this can be done via the Process class but all my efforts have so far failed.
I'm thinking that the solution may look something like the following, but im not too sure what im doing and could be way off:
Dim myProcess() As Process = Process.GetProcessesByName("ImportApp", ".")
Dim fileList As List (of importFile) = myProcess(0).GetObjectRef( ??????????? )
Any help would be greatly appreciated, thanks.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
如果您的服务是用 .NET 编写的,您可以使用 远程处理< /a> 公开您的服务对象,详细信息请参见此处。
If your service is written in .NET you can use remoting to expose your service's objects as detailed here.