码迷,mamicode.com
首页 > 其他好文 > 详细

Remoting 简单配置

时间:2017-11-03 13:06:54      阅读:96      评论:0      收藏:0      [点我收藏+]

标签:client   setup   channels   inf   通道   创建对象   host   注册   nbsp   

1 服务端

<configuration>
<system.runtime.remoting>
<application>
<channels>
<channel ref="tcp" port="8086"/>//端口注册成功,telnet可以通
</channels>
<service>
<wellknown type="a 类名(加命名空间),包含此类的程序集名称" objectUri="b 客户端访问时的url对象名称(用类名即可)" mode="SingleCall" />//type 为类型的限定名称,
</service>
</application>
</system.runtime.remoting>
</configuration>

//服务端注册 保证程序集合处在服务程序目录中,(项目不添加程序集的引用也可以)

 System.Runtime.Remoting.RemotingConfiguration.Configure(AppDomain.CurrentDomain.SetupInformation.ConfigurationFile, false);

 

2 客户端

<configuration>
<system.runtime.remoting>
<application>
<client ref="tcp">//通道保持一致
<wellknown type="c 类名(加命名空间可以是接口),包含此类(接口)的程序集名称" url="d tcp://localhost:8086/服务器Url中的对象名称" />
</client>
</application>
</system.runtime.remoting>
</configuration>

 System.Runtime.Remoting.RemotingConfiguration.Configure(AppDomain.CurrentDomain.SetupInformation.ConfigurationFile, false);

Activator.GetObject(e Type type,f string url);//创建对象

 

服务端注册a类型

客户端注册c类型

Activator.GetObject(e Type type,f string url);//根据类型c创建类型a对象

通过e的类型(既客户端c类型)和f的url(既客户端d),访问到服务器 b的url从而找到 a的类型并创建对象。

 

Remoting 简单配置

标签:client   setup   channels   inf   通道   创建对象   host   注册   nbsp   

原文地址:http://www.cnblogs.com/shenshiting/p/7777553.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!