I cannot have more than one SingleCall or Singleton object to activate on
server side in the same time / on different threads.

I have a stand-alone EXE:

     static void Main(string[] args)
     {
         // Register channel and instance factory
         ChannelServices.RegisterChannel (new TcpChannel (777));
         RemotingConfiguration.RegisterWellKnownServiceType (
             typeof (RemotingSample.ServerObject),
             "ServerObject",
             WellKnownObjectMode.SingleCall);

         // Shut down on user input
         System.Console.WriteLine("Starting. Hit <enter> to exit...");
         System.Console.ReadLine();
     }

The RemotingSample.ServerObject has the following method:

         public int BounceInteger (int n)
         {
             int idThread = Thread.CurrentThread.GetHashCode();
             Console.WriteLine ("Thread {0} working...", idThread);
             Thread.Sleep (5000);
             Console.WriteLine ("Thread {0} done work.", idThread);
             return n;
         }

A client obviously activates and calls this object (I am omitting
an interface IServerObject, it is exposed by ServerObject):

     static void Main(string[] args)
     {
         ChannelServices.RegisterChannel (new TcpChannel ());
         RemotingSample.IServerObject o =
             (RemotingSample.IServerObject)Activator.GetObject (
                 typeof (RemotingSample.IServerObject),
                 @"tcp://buoyant:777/ServerObject");

         Console.WriteLine ("Call began");
         int x = o.BounceInteger (42);
         Console.WriteLine ("Call ended: {0}", x);
     }

When I run many clients at once, the calls are executed sequentially on
the server, and in the same thread.  Clients are hanging in line...
I tried also compiling a service and moving the code from the server
sans "press enter to exit" to OnStart, to no avail.

I suppose that there should be some magic to enable thread pooling.  There
were a lot of talks on Usenet about remoting and threading, and I got an
impression that threading worked automatically for everyone...

...But me!  Help!!!

  -kkm

You can read messages from the DOTNET archive, unsubscribe from DOTNET, or
subscribe to other DevelopMentor lists at http://discuss.develop.com.

Reply via email to