技术开发 频道

.Net Remoting配置文件的用法

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。

0
相关文章