locked
Remoting from a Windows Service RRS feed

  • Question

  • I am trying to run a remote server from a Windows Service. I have the following code being run from a thread during the OnStart function:

     

    TcpChannel channel = new TcpChannel(8045);

    ChannelServices.RegisterChannel(channel, true);

    RemotingConfiguration.RegisterWellKnownServiceType(typeof(RemoteObject.RemoteObject),

    "RemoteObject", WellKnownObjectMode.SingleCall);

     

     

    Then the function waits to exit when the OnStop function is called. I have also tried putting this code directly in the OnStart function. Either way it does not work. When I try to make a remote procedure call the cliet app hangs. There is no error or exception. If I put the same server code in an application instead of a service, everything works fine. What is the difference between running this code in a service as opposed to an application? Should I be able to do this from a service?

     

    Thanks for any help.
    Sunday, May 20, 2007 6:00 PM

Answers

  • Sorry, I'm an idoit. I forgot to open a channel in the client and when I tested with a windows app I was running the server and client in the same app so the channel was being shared. It works fine now. Seems like that should maybe throw an exception or something though.

     

    Monday, May 21, 2007 4:00 PM