.Net Remoting:Windows 时间更改导致状态不一致
[我是 C++ 开发人员,现在从事 C# 和 C# 开发工作。 .net概念,所以问题可能非常基本]
我有一个基于.Net Remoting的服务器和客户端。问题是,当我更改 Windows 时间时,客户端和服务器之间的会话会发生变化。我问了提供这段代码的专家,据他说“在.NET Remoting中,远程对象的生命周期是基于租约的 时间。如果租约到期,该对象将被标记为 GC”因此,当我更改租约到期时间时,对象将被 GC 收集。
客户端和服务器都在同一系统上运行。
有人可以建议我出了什么问题以及如何纠正这个问题吗? 。
谢谢
[I am C++ developer now working on C# & .net concept , So question may be very basic ]
I have a Server and Client based on .Net Remoting. Problem is that when i change windows time , Session between client and server goes for a toss. I asked expert who delivered this code , According to him "In .NET Remoting, remote object lifetimes are based on lease
time. If the lease expires, the object is marked for GC" So when i change time lease expire and object is collected by GC.
Client and server both are running on same system.
Can some body suggest me what is going wrong and how to correct this issue.
Thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我不知道这是否是一个解决方案,但请尝试一下。
我认为如果您监视 Windows 时间更改,您可以关闭并重新启动远程连接。
我找到了这个链接,希望没有用。
I don't know if this is a solution, but give it a try.
I think if you monitor for Windows time change you can close and restart your remoting connection.
I've found this link, hope is't useful.
感谢大家的回答。我找到了根本原因。这是一种巧妙的方法,客户端时间的线程定期调用服务器。
这样服务器就知道客户端还活着并正确地保持租约时间。一旦时间改变。定期调用服务器的巧妙方法值得折腾。并在服务器端处理对象。
Thanks all for your answers. I found the root cause . Its a ingenious way where a thread from client time calls server at regular interval.
So this way Server knows that client is alive and keep lease time properly. Once time is changed. Ingenious way of calling server at regular interval goes for a toss. and on server side object is disposed.