“Object has been disconnected or does not exist at the server” exception

后端 未结 7 831
孤街浪徒
孤街浪徒 2020-12-04 19:31

I need to use cross-appdomain calls in my app, and sometimes I have this RemotingException:

Object \'/2fa53226_da41_42ba_b185_ec7d9c454712/ygiw+xfegmk

7条回答
  •  隐瞒了意图╮
    2020-12-04 19:53

    This is because the Lifetime management on the server side disconnects the object when its lease expires, to allow GC to collect it. If you try to use it from the client side, you will get an Exception, even if it has not been GC'd on the server yet (e.g. because there still is another reference to it) but the lease has expired. This is to avoid unpredictable behaviour. The accepted answer provides a good reference on how to correctly manage the lifetime of Remote .NET Objects.

提交回复
热议问题