【发布时间】:2023-11-03 01:21:01
【问题描述】:
在服务器中注册对象时
RemotingConfiguration.RegisterWellKnownServiceType(typeof(Interfaces.client), Singleton", WellKnownObjectMode.Singleton); //in the server
然后在客户端中检索它
Interfaces.client mgr = (Interfaces.client)(Activator.GetObject(typeof(Interfaces.client), "tcp://localhost:1234/Singleton")); //in the client
这样就可以从客户端访问对象,并且我们可以看到服务器端的修改,这已经完成了。 我的具体问题是:创建对象后,我在哪里可以找到服务器中的对象引用? (在单例或单调用模式下),我知道会有几个实例,如果它是单调用模式,即使我假设实例是由某些命名服务机制存储的,或者直接存储在内存中的某个列表中。 请原谅我的英语不好
【问题讨论】:
标签: c# .net singleton client-server remoting