Remoting配置文件的用法
时间:2022-06-11
本文章向大家介绍Remoting配置文件的用法,主要内容包括其使用实例、应用技巧、基本知识点总结和需要注意事项,具有一定的参考价值,需要的朋友可以参考一下。
1,如下是Server端典型的Remoting配置文件:
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<system.runtime.remoting>
<application>
<channels>
<channel ref="http"/>
</channels>
<service>
<wellknown mode="Singleton"
type="ComponentHost.CustomerManager, ComponentHost"
objectUri="CustomerManager.soap" />
</service>
</application>
</system.runtime.remoting>
</configuration>
(1)当Remote Objects部署在Console/Windows Form、Windows Services下时(上面的配置文件channel需要设置port属性),相应Server端声明Remote Objects的代码可以简化为:
string filename = "server.exe.config";
RemotingConfiguration.Configure(filename);
(2)如果Remote Objects部署在IIS时,根本就不需要任何代码声明。但是需要将上述配置文件命名为:web.config,并且将Remote Objects的DLL文件安置在web application的BIN文件夹。
一般在实际应用中,基本上将Remote Objects部署在IIS环境中,好处是(I)不需要编写额外的代码;(II)只要启动机器,远程对象就启动了。不需要你半夜三更跑到公司去登录,然后启动发生故障的远程服务;(III)容易与IIS认证服务进行集成;(IV)可能还有更多优点,我现在没有想到。
(3)如果需要声明多个远程对象,只需要在<service>与</service>之间添加相应的Remote Objects配置信息即可。
(4)另外需要注意type属性为:<namespace>.<class>, <assembly>
2,如下是Client端典型的配置文件:
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<system.runtime.remoting>
<application>
<client>
<wellknown type="ComponentHost.CustomerManager, RemotingTest"
url="http://localhost/ComponentHost/CustomerManager.soap" />
</client>
</application>
</system.runtime.remoting>
</configuration>
要注意type属性的设定:<namespace>.<class>, <assembly>
如果Client通过SoapSuds产生Remote Objects的元数据assembly,或者是Shared Assembly(如Interface或Abstract Class),这里<assembly>则为上述assembly的名称。
如果是通过SoapSuds产生Source code,则<assembly>为Client应用程序名(无exe后缀)。
同时,Client端application调用Remote Objects时,可以省掉:注册通道、Activator.GetObject()/RemotingConfiguration.RegisterActivatedServiceType()等代码,取而代之的代码为:
string filename = “clientApplication.exe.config”;
RemotingConfiguration.Configure(filename);
下面通过new来创建Remote Object实例。
3,标准的.Net Remoting Configuration配置文件
MSDN中有.Net Remoting Configuration file中全部元素/属性的完整的详细说明,需要的时候再查阅了。一般情况下,知道下面这些属性就够用了。
<configuration>
<system.runtime.remoting>
<application>
<lifetime /> ―― 配置Remote Objects生存期的信息
<channels /> ―― 配置与远程对象进行通信的信道
<service />
<client />
</application>
</system.runtime.remoting>
</configuration>
简单说明:
(1)<service> ―― 仅在Server端配置
<service>
<wellknown /> ―― 配置要发布的SAO(已知)对象的信息
<activated /> ―― 配置要发布的CAO客户端激活对象的信息
</service>
(2)<client> ―― 仅在Client端配置,与Server端<service>对应
<client>
<wellknown />
<activated />
</client>
When using CAOs, the <client> property has to specify the URI to the server for all underlying <activated> entries.
Note:When using CAOs from more than one server, you have to create several <client> properties in your configuration file.
当调用CAO远程对象时,必须设定<client>的url属性。如果CAO来自不同的Server,则需要在配置文件中定义多个<client>。如下所示:
<client url="http://localhost/MyServer>
<activated type="Server.MyRemote, Client" />
</client>
4,定制Client/Server Channel元素
(1)Client Side
<channel ref="http">
<clientProviders>
<formatter ref="binary" />
</clientProviders>
</channel>
其中,formatter ref=”binary” or “soap”。formatter ref指要在通道上发送的消息格式,在此示例中为二进制,以增强性能。
(2)Server Side
<channel ref="http">
<serverProviders>
<provider ref="wsdl" />
<formatter ref="binary" typeFileterLevel="Full" />
<formatter ref="soap" typeFileterLevel="Full" />
</serverProviders>
</channels>
typeFilterLevel表示当前自动反序列化级别,支持的值包括 Low(默认值)和 Full。
本文转载:http://www.cnblogs.com/rickie/archive/2004/10/10/50392.html
- 资源等待类型sys.dm_os_wait_stats
- NVIDIA不再允许数据中心用GeForce驱动,提供区块链服务除外
- 非常强悍并实用的双机热备+负载均衡线上方案
- Apache 压力测试工具ab
- SQL之收集SQL Server线程等待信息
- 聚合索引(clustered index) / 非聚合索引(nonclustered index)
- 域名资讯:单词域名can.com以15.5万美金成功交易
- jQuery无缝图片横向(水平)/竖向(垂直)滚动
- Centos下MooseFS(MFS)分布式存储共享环境部署记录
- MFS+Keepalived双机高可用热备方案操作记录
- Docker容器学习梳理-容器时间跟宿主机时间同步
- AS1.0(2.0)中的XML示例
- kvm虚拟机日常操作命令梳理
- mongodb 总结
- JavaScript 教程
- JavaScript 编辑工具
- JavaScript 与HTML
- JavaScript 与Java
- JavaScript 数据结构
- JavaScript 基本数据类型
- JavaScript 特殊数据类型
- JavaScript 运算符
- JavaScript typeof 运算符
- JavaScript 表达式
- JavaScript 类型转换
- JavaScript 基本语法
- JavaScript 注释
- Javascript 基本处理流程
- Javascript 选择结构
- Javascript if 语句
- Javascript if 语句的嵌套
- Javascript switch 语句
- Javascript 循环结构
- Javascript 循环结构实例
- Javascript 跳转语句
- Javascript 控制语句总结
- Javascript 函数介绍
- Javascript 函数的定义
- Javascript 函数调用
- Javascript 几种特殊的函数
- JavaScript 内置函数简介
- Javascript eval() 函数
- Javascript isFinite() 函数
- Javascript isNaN() 函数
- parseInt() 与 parseFloat()
- escape() 与 unescape()
- Javascript 字符串介绍
- Javascript length属性
- javascript 字符串函数
- Javascript 日期对象简介
- Javascript 日期对象用途
- Date 对象属性和方法
- Javascript 数组是什么
- Javascript 创建数组
- Javascript 数组赋值与取值
- Javascript 数组属性和方法
- 好用到飞起的12个jupyter lab插件
- Debug LinkedList
- Java对象公约
- 【Flutter 专题】96 图解 Draggable + DragTarget 基本拖拽效果
- Spring 基于注解(annotation)的配置之@Autowired注解
- 人心易变,这段有趣的C代码也一样!!!
- matplotlib绘制常见统计图形(一)
- python与安全(二)格式化字符串和Flask session
- ROS2机器人笔记20-07-24
- Postgresql 渗透利用总结
- Spring 基于注解(annotation)的配置之@Required注解
- 由一个系统激活工具引起的一次简单测试
- Golang channel 快速入门
- 潘石屹用Python解决100个问题 | 素数
- Spring 自动装配模式之构造函数装配方式