Although it's not what your original question seemed to be asking, it looks
like what you're trying to do is to get a reference to your singleton on the
server so you can raise events which will then be handled by the clients.
The code as you have it below is an awkward and inefficient way of doing
this as essential you're making the server a client of itself. Any method
calls to the UserServer object will have to go through all the remoting
mechanisms even though the object is actually in the same process/AppDomain.
To get a reference to the actual singleton without using GetObject() on the
server, do this:
1) Declare and instantiate a static instance of your UserServer class.
2) Replace the code that calls RegisterWellKnownServiceType() with code that
instead calls RemotingServices.Marshal(), passing in your static instance
and your URI (User.soap).
Now, in your server code, you can simply reference the static variable to
get the same instance of the UserServer class as is being accessed by the
clients.
Hope that helps -
Ken
> I did exactly what you explained, the methods are invoked even on different
> machine, but when I created some events, they aren't fired if the client is
[quoted text clipped - 12 lines]
> HttpChannel channel = new HttpChannel(prop, clientProvider, serverProvider);
> ChannelServices.RegisterChannel(channel);
System.Runtime.Remoting.RemotingConfiguration.RegisterWellKnownServiceType(t
> ypeof(UserServer), "User.soap",
> System.Runtime.Remoting.WellKnownObjectMode.Singleton);
[quoted text clipped - 5 lines]
> create it.
> Thanks!
cnfr - 17 Dec 2004 07:59 GMT
Thanks Ken!
I told you that I was pretty sure that the way wasn't right.
Unfortunately, it did not work that way you explained me.
Anyway, I appreciate your promptitude
Adrian - 17 Dec 2004 08:30 GMT
I have to apologize.
I made a stupid mistake. Now it works!
Thanks a lot!