<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<!-- saved from url=(0061)http://www.cnblogs.com/wayfarer/archive/2004/07/30/28723.html -->
<HTML><HEAD id=Head><TITLE>Microsoft .Net Remoting系列专题之一:.Net Remoting基础篇 - 张逸:晴窗笔记 - 博客园</TITLE>
<META http-equiv=Content-Type content="text/html; charset=utf-8">
<META id=metaKeywords content="Microsoft .Net Remoting系列专题之一:.Net Remoting基础篇 "
name=keywords><LINK id=MainCss
href="Microsoft _Net Remoting系列专题之一_Net Remoting基础篇 - 张逸晴窗笔记 - 博客园.files/style.css"
type=text/css rel=stylesheet><LINK id=SecondaryCss
href="Microsoft _Net Remoting系列专题之一_Net Remoting基础篇 - 张逸晴窗笔记 - 博客园.files/customcss.css"
type=text/css rel=stylesheet><LINK id=RSSLink title=RSS
href="http://www.cnblogs.com/wayfarer/rss.aspx" type=application/rss+xml
rel=alternate>
<META content="MSHTML 6.00.2900.3243" name=GENERATOR></HEAD>
<BODY>
<FORM id=Form1 name=Form1 onsubmit="javascript:return WebForm_OnSubmit();"
action=28723.html method=post>
<DIV><INPUT id=__EVENTTARGET type=hidden name=__EVENTTARGET> <INPUT
id=__EVENTARGUMENT type=hidden name=__EVENTARGUMENT> <INPUT
id=" __VIEWSTATE" type=hidden name=__VIEWSTATE> </DIV>
<SCRIPT type=text/javascript>
<!--
var theForm = document.forms['Form1'];
if (!theForm) {
theForm = document.Form1;
}
function __doPostBack(eventTarget, eventArgument) {
if (!theForm.onsubmit || (theForm.onsubmit() != false)) {
theForm.__EVENTTARGET.value = eventTarget;
theForm.__EVENTARGUMENT.value = eventArgument;
theForm.submit();
}
}
// -->
</SCRIPT>
<SCRIPT
src="Microsoft _Net Remoting系列专题之一_Net Remoting基础篇 - 张逸晴窗笔记 - 博客园.files/WebResource.axd"
type=text/javascript></SCRIPT>
<SCRIPT language=JavaScript>
function ctlent(evt,id)
{
if(evt.ctrlKey && evt.keyCode == 13)
{
try
{
TempSave(id);
}
catch(ex)
{
}
finally
{
__doPostBack('AjaxHolder$PostComment$btnSubmit','')
}
}
}</SCRIPT>
<SCRIPT language=JavaScript>function SetReplyAuhor(author){document.getElementById('AjaxHolder_PostComment_tbComment').value+="@"+author+"\n";document.getElementById('AjaxHolder_PostComment_tbComment').focus();return false}</SCRIPT>
<SCRIPT
src="Microsoft _Net Remoting系列专题之一_Net Remoting基础篇 - 张逸晴窗笔记 - 博客园.files/ScriptResource.axd"
type=text/javascript></SCRIPT>
<SCRIPT
src="F:\C#网络教程\remotin资料\Microsoft _Net Remoting系列专题之一_Net Remoting基础篇 - 张逸晴窗笔记 - 博客园.files\ScriptResource(1).axd"
type=text/javascript></SCRIPT>
<SCRIPT
src="F:\C#网络教程\remotin资料\Microsoft _Net Remoting系列专题之一_Net Remoting基础篇 - 张逸晴窗笔记 - 博客园.files\ScriptResource(2).axd"
type=text/javascript></SCRIPT>
<SCRIPT
src="Microsoft _Net Remoting系列专题之一_Net Remoting基础篇 - 张逸晴窗笔记 - 博客园.files/js"
type=text/javascript></SCRIPT>
<SCRIPT type=text/javascript>
<!--
function WebForm_OnSubmit() {
if (typeof(ValidatorOnSubmit) == "function" && ValidatorOnSubmit() == false) return false;
return true;
}
// -->
</SCRIPT>
<DIV id=blogtopad>
<SCRIPT type=text/javascript><!--
google_ad_client = "pub-9345650523463844";
google_ad_width = 468;
google_ad_height = 60;
google_ad_format = "468x60_as";
google_ad_type = "image";
google_ad_channel = "";
//--></SCRIPT>
<SCRIPT
src="Microsoft _Net Remoting系列专题之一_Net Remoting基础篇 - 张逸晴窗笔记 - 博客园.files/show_ads.js"
type=text/javascript>
</SCRIPT>
</DIV>
<DIV id=header>
<H1><A class=headermaintitle id=Header1_HeaderTitle
href="http://www.cnblogs.com/wayfarer/">张逸:晴窗笔记</A></H1>
<P id=tagline><!--end 版权保护 --><A
href="http://creativecommons.org/licenses/by-nc-nd/2.5/cn/" rel=license><IMG
style="BORDER-TOP-WIDTH: 0px; BORDER-LEFT-WIDTH: 0px; BORDER-BOTTOM-WIDTH: 0px; BORDER-RIGHT-WIDTH: 0px"
alt="Creative Commons License"
src="Microsoft _Net Remoting系列专题之一_Net Remoting基础篇 - 张逸晴窗笔记 - 博客园.files/88x31.png"></A>
<!-- 版权保护 --></P></DIV>
<DIV id=main>
<SCRIPT type=text/javascript>
//<![CDATA[
Sys.WebForms.PageRequestManager._initialize('AjaxHolder$scriptmanager1', document.getElementById('Form1'));
Sys.WebForms.PageRequestManager.getInstance()._updateControls(['tAjaxHolder$UpdatePanel1'], [], [], 90);
//]]>
</SCRIPT>
<DIV class=post>
<H2><A id=AjaxHolder_ctl01_TitleUrl
href="http://www.cnblogs.com/wayfarer/archive/2004/07/30/28723.html">Microsoft
.Net Remoting系列专题之一:.Net Remoting基础篇 </A></H2>
<DIV class=postText>
<P><FONT face=楷体_GB2312>我写的.Net Remoting系列专题:</FONT></P>
<P><A id=viewpost1_TitleUrl
href="http://www.cnblogs.com/wayfarer/archive/2004/08/05/30437.html"><FONT
color=#000080>Microsoft .Net
Remoting系列专题之二:Marshal、Disconnect与生命周期以及跟踪服务</FONT></A></P>
<P><A id=viewpost1_TitleUrl
href="http://www.cnblogs.com/wayfarer/articles/75213.html"><FONT
color=#000080>Microsoft .Net Remoting系列专题之三:Remoting事件处理全接触</FONT></A></P>
<P><STRONG>Microsoft .Net Remoting系列专题之一</STRONG></P>
<P><STRONG>一、Remoting基础</STRONG></P>
<P>什么是Remoting,简而言之,我们可以将其看作是一种分布式处理方式。从微软的产品角度来看,可以说Remoting就是DCOM的一种升级,它改善了很多功能,并极好的融合到.Net平台下。Microsoft®
.NET Remoting
提供了一种允许对象通过应用程序域与另一对象进行交互的框架。这也正是我们使用Remoting的原因。为什么呢?在Windows操作系统中,是将应用程序分离为单独的进程。这个进程形成了应用程序代码和数据周围的一道边界。如果不采用进程间通信(RPC)机制,则在一个进程中执行的代码就不能访问另一进程。这是一种操作系统对应用程序的保护机制。然而在某些情况下,我们需要跨过应用程序域,与另外的应用程序域进行通信,即穿越边界。</P>
<P>在Remoting中是通过通道(channel)来实现两个应用程序域之间对象的通信的。如图所示:</P>
<P align=center><IMG height=341
src="Microsoft _Net Remoting系列专题之一_Net Remoting基础篇 - 张逸晴窗笔记 - 博客园.files/Remoting1.jpg"
width=650 border=0 mce_src="/images/cnblogs_com/wayfarer/Remoting1.jpg"></P>
<P>首先,客户端通过Remoting,访问通道以获得服务端对象,再通过代理解析为客户端对象。这就提供一种可能性,即以服务的方式来发布服务器对象。远程对象代码可以运行在服务器上(如服务器激活的对象和客户端激活的对象),然后客户端再通过Remoting连接服务器,获得该服务对象并通过序列化在客户端运行。</P>
<P>在Remoting中,对于要传递的对象,设计者除了需要了解通道的类型和端口号之外,无需再了解数据包的格式。但必须注意的是,客户端在获取服务器端对象时,并不是获得实际的服务端对象,而是获得它的引用。这既保证了客户端和服务器端有关对象的松散耦合,同时也优化了通信的性能。</P>
<P><STRONG>1、Remoting的两种通道</STRONG></P>
<P>Remoting的通道主要有两种:Tcp和Http。在.Net中,System.Runtime.Remoting.Channel中定义了IChannel接口。IChannel接口包括了TcpChannel通道类型和Http通道类型。它们分别对应Remoting通道的这两种类型。</P
评论1
最新资源