【问题标题】:RemotingServices.Marshal(foo, uri) only works for a short period of time. How to keep it working?RemotingServices.Marshal(foo, uri) 仅在短时间内有效。如何保持工作?
【发布时间】:2013-04-23 15:41:31
【问题描述】:

当我这样做时

RemotingServices.Marshal(foo, uri);

客户端连接,一切正常。当我等待几分钟,然后尝试连接客户端时,客户端会抛出 RemotingException:对象“{服务名称}”已断开连接或在服务器上不存在。

这里发生了什么?是否存在某种超时?

【问题讨论】:

    标签: c# .net marshalling remoting


    【解决方案1】:

    为避免超时,您可以向远程对象添加以下重写方法:

    public override object InitializeLifetimeService(){
      return null;
    }
    

    【讨论】:

    • 是的,这可以确保远程对象永远不会死亡(即无限租约时间)(默认情况下,它最初会存活 5 分钟)
    猜你喜欢
    • 2013-01-17
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2022-11-15
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多