Anyway, what all I need to is to know which user is calling some function. I don't need to impersonate or delegation. So there is a simpler way:
On server, just use
IChannel tsc = new TcpServerChannel(8888);
ChannelServices.RegisterChannel(tsc, true);
Note you have to specify ture when you register the channel. Then you are ready to publish objects, either by RemotingConfiguration.RegisterWellKnownServiceType, or by RemotingServices.Marshal.
At client side, you MUST register a TcpClientChannel also with true to the 2nd parameter before activating the server objects. If you forget this, or put false, the client will not be connected correctly.
TcpClientChannel tcp = new TcpClientChannel();
ChannelServices.RegisterChannel(tcp, true);
_Server = (IService)Activator.GetObject(typeof(IService), "tcp://localhost:8888/ASvc");
That's it, no ugly hashtable for parameter passing and still you can pass the caller's identity to server.
No comments:
Post a Comment