.net远程处理中按值排列的元帅和按引用的元帅之间的区别 [英] difference between Marshal by value and Marshal by ref in .net remoting

查看:99
本文介绍了.net远程处理中按值排列的元帅和按引用的元帅之间的区别的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

.net远程处理中按值进行封送与按引用进行封送之间的主要区别是什么?

what is main difference between Marshal by value and Marshal by ref in .net remoting?

推荐答案

MBV:在此服务器中创建对象的精确副本并
将其发送给客户端.客户端可以将其与
一起使用 在其AppDomain中,而无需进一步调用
服务器.
但这有一个缺点,发送给客户的副本将是
静态且不会反映后续更改.因此其
最好在不断更新的情况下不要使用MBV.

MBR:DotNet Framework在客户端上创建代理
客户端用于访问对象的AppDomain
在服务器上.我们需要为
扩展"MarshalByRefObject" 这个.
但这有一个缺点,它增加了网络流量
因为可以访问服务器的次数很多.

因此,这取决于我们的要求.带有
的小对象 频繁访问,我们可以使用MBR和具有
的大型对象 相对较低的访问权限,我们可以使用MBV.
MBV:In this Server Creates a exact Copy of the Object and
sends it to the Client.Which can be used by the Client with
in its AppDomain with out making any further calls to the
server.
But this has a drawback,the copy sent to client will be
static and will not reflect the subsequent changes.So its
better not to use MBV when there are constant updates.

MBR:DotNet Framework creates a Proxy on the Client
AppDomain which the client uses for accessing the Objects
on the Server.We need to extend ''MarshalByRefObject'' for
this.
But this to has a drawback,it increases the network traffic
as there can ba number of accesses to the Server.

So its depends upon our requirement.Small objects with
frequent accesses,we can go with MBR and huge Objects with
relatively low accesses we can go with MBV.


准确地说:

按值封送:服务器创建
的副本 对象,并将副本传递给客户端.


通过引用进行编组:客户端为
创建代理 对象,然后使用代理访问该对象.

检查 [
To be precise:

Marshal by value: The server creates a copy of the
object and passes the copy to the client.


Marshal by reference: the client creates a proxy for the
object and then uses the proxy to access the object.

Check THIS[^] for more details.

NOTE: Please use google first before posting your question here!


hope it helps :)


这篇关于.net远程处理中按值排列的元帅和按引用的元帅之间的区别的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆