views:

19

answers:

0

Hi,

The goal is for my main application to either launch or be told when a usb device is inserted.

To achieve this, I created a windows service and a shared remote object. I have a little windows forms application that runs in the background to launch the application.

Its the little windows forms application I'm struggling with. How can I get it to start automatically and stay running throughout the user session? It seems to me I'm asking for a lot of bugs with this design.

This little intermediate application simply does this:

channel = new TcpChannel(55555);
ChannelServices.RegisterChannel(channel, false);
RemotingConfiguration.RegisterWellKnownServiceType(typeof(SharedRemoteObject.RemoteObject), "USBDetectServer", WellKnownObjectMode.SingleCall);

That's all this thing does. What is stopping me from putting this in the service itself, rather than have this intermediate program running?

If I can't put it in the service, does anyone have suggestions about how you can have a little, GUI-less application running throughout the user session that is not a service?