Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/331.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 如何创建一个类似守护进程的应用程序来接收来自windows服务的信息?_C#_Windows Services - Fatal编程技术网

C# 如何创建一个类似守护进程的应用程序来接收来自windows服务的信息?

C# 如何创建一个类似守护进程的应用程序来接收来自windows服务的信息?,c#,windows-services,C#,Windows Services,目标是让我的主应用程序在插入usb设备时启动或被告知 为了实现这一点,我创建了一个windows服务和一个共享远程对象。我有一个在后台运行的小windows窗体应用程序来启动应用程序 这就是我正在努力使用的小windows窗体应用程序。如何让它自动启动并在整个用户会话中保持运行?在我看来,这种设计有很多缺陷 这个小小的中间应用程序只是这样做的: channel = new TcpChannel(55555); ChannelServices.RegisterChannel(channel, fa

目标是让我的主应用程序在插入usb设备时启动或被告知

为了实现这一点,我创建了一个windows服务和一个共享远程对象。我有一个在后台运行的小windows窗体应用程序来启动应用程序

这就是我正在努力使用的小windows窗体应用程序。如何让它自动启动并在整个用户会话中保持运行?在我看来,这种设计有很多缺陷

这个小小的中间应用程序只是这样做的:

channel = new TcpChannel(55555);
ChannelServices.RegisterChannel(channel, false);
RemotingConfiguration.RegisterWellKnownServiceType(typeof(SharedRemoteObject.RemoteObject), "USBDetectServer", WellKnownObjectMode.SingleCall);
这东西就是这么做的。是什么阻止我将其放入服务本身,而不是让这个中间程序运行

如果我不能把它放到服务中,有没有人对如何让一个小的、无GUI的应用程序在非服务的整个用户会话中运行有什么建议