[Remoting专题系列] 十二:配置文件使用配置文件替代硬编码可使应用程序拥有更高的灵活性,尤其是对分布式系统而言,意味着我们可以非常方便地调整分布对象的配置。Remoting 的配置文件比较简单,详细信息可以参考 MSDN。 
[Remoting专题系列] 十二:配置文件
[Remoting专题系列] 十二:配置文件ms
-help://MS.MSDNQTR.v80.chs/MS.MSDN.v80/MS.NETDEVFX.v20.chs/dv_fxgenref/html/52ebd450-de87-4a87-8bb9-6b13426fbc63.htm
[Remoting专题系列] 十二:配置文件

[Remoting专题系列] 十二:配置文件下面是个简单的例子,包含了 SAO 
/ CAO 的配置样例。
[Remoting专题系列] 十二:配置文件
[Remoting专题系列] 十二:配置文件Server.cs
[Remoting专题系列] 十二:配置文件BinaryClientFormatterSinkProvider cbin 
= new BinaryClientFormatterSinkProvider();
[Remoting专题系列] 十二:配置文件BinaryServerFormatterSinkProvider sbin 
= new BinaryServerFormatterSinkProvider();
[Remoting专题系列] 十二:配置文件sbin.TypeFilterLevel 
= TypeFilterLevel.Full;
[Remoting专题系列] 十二:配置文件
[Remoting专题系列] 十二:配置文件Hashtable properties 
= new Hashtable();
[Remoting专题系列] 十二:配置文件properties[
"port"= 801;
[Remoting专题系列] 十二:配置文件
[Remoting专题系列] 十二:配置文件TcpChannel channel 
= new TcpChannel(properties, cbin, sbin);
[Remoting专题系列] 十二:配置文件ChannelServices.RegisterChannel(channel, 
false);
[Remoting专题系列] 十二:配置文件
[Remoting专题系列] 十二:配置文件RemotingConfiguration.RegisterWellKnownServiceType(
typeof(Data), "data", WellKnownObjectMode.Singleton);
[Remoting专题系列] 十二:配置文件RemotingConfiguration.ApplicationName 
= "test";
[Remoting专题系列] 十二:配置文件RemotingConfiguration.RegisterActivatedServiceType(
typeof(Data2));
[Remoting专题系列] 十二:配置文件
[Remoting专题系列] 十二:配置文件Client.cs
[Remoting专题系列] 十二:配置文件TcpChannel channel 
= new TcpChannel();
[Remoting专题系列] 十二:配置文件ChannelServices.RegisterChannel(channel, 
false);
[Remoting专题系列] 十二:配置文件RemotingConfiguration.RegisterWellKnownClientType(
typeof(Data), "tcp://localhost:801/data");
[Remoting专题系列] 十二:配置文件RemotingConfiguration.RegisterActivatedClientType(
typeof(Data2), "tcp://localhost:801/test");
[Remoting专题系列] 十二:配置文件
[Remoting专题系列] 十二:配置文件Data data 
= new Data();
[Remoting专题系列] 十二:配置文件data.Test();
[Remoting专题系列] 十二:配置文件
[Remoting专题系列] 十二:配置文件Data2 data2 
= new Data2();
[Remoting专题系列] 十二:配置文件data2.Test();
[Remoting专题系列] 十二:配置文件
[Remoting专题系列] 十二:配置文件改成对应的配置文件,就是下面这个样子。
[Remoting专题系列] 十二:配置文件
[Remoting专题系列] 十二:配置文件Server.config
[Remoting专题系列] 十二:配置文件
<?xml version="1.0" encoding="utf-8" ?>
[Remoting专题系列] 十二:配置文件
<configuration>
[Remoting专题系列] 十二:配置文件  
<system.runtime.remoting>
[Remoting专题系列] 十二:配置文件    
<application name="test">
[Remoting专题系列] 十二:配置文件      
<channels>
[Remoting专题系列] 十二:配置文件        
<channel ref="tcp" port="801">
[Remoting专题系列] 十二:配置文件          
<clientProviders>
[Remoting专题系列] 十二:配置文件            
<formatter ref="binary"/>
[Remoting专题系列] 十二:配置文件          
</clientProviders>
[Remoting专题系列] 十二:配置文件          
<serverProviders>
[Remoting专题系列] 十二:配置文件            
<formatter ref="binary" typeFilterLevel="Full" />
[Remoting专题系列] 十二:配置文件          
</serverProviders>
[Remoting专题系列] 十二:配置文件        
</channel>
[Remoting专题系列] 十二:配置文件      
</channels>
[Remoting专题系列] 十二:配置文件      
<service>
[Remoting专题系列] 十二:配置文件        
<wellknown mode="Singleton" type="Learn.Library.Remoting.Data, Learn.Library" objectUri="data" />
[Remoting专题系列] 十二:配置文件        
<activated type="Learn.Library.Remoting.Data2, Learn.Library" />
[Remoting专题系列] 十二:配置文件      
</service>
[Remoting专题系列] 十二:配置文件    
</application>
[Remoting专题系列] 十二:配置文件  
</system.runtime.remoting>
[Remoting专题系列] 十二:配置文件
</configuration>
[Remoting专题系列] 十二:配置文件
[Remoting专题系列] 十二:配置文件Client.config
[Remoting专题系列] 十二:配置文件
<?xml version="1.0" encoding="utf-8" ?>
[Remoting专题系列] 十二:配置文件
<configuration>
[Remoting专题系列] 十二:配置文件  
<system.runtime.remoting>
[Remoting专题系列] 十二:配置文件    
<application>
[Remoting专题系列] 十二:配置文件      
<channels>
[Remoting专题系列] 十二:配置文件        
<channel ref="tcp">
[Remoting专题系列] 十二:配置文件          
<clientProviders>
[Remoting专题系列] 十二:配置文件            
<formatter ref="binary"/>
[Remoting专题系列] 十二:配置文件          
</clientProviders>
[Remoting专题系列] 十二:配置文件        
</channel>
[Remoting专题系列] 十二:配置文件      
</channels>
[Remoting专题系列] 十二:配置文件      
<client url="tcp://localhost:801/test">
[Remoting专题系列] 十二:配置文件        
<wellknown type="Learn.Library.Remoting.Data, Learn.Library" url="tcp://localhost:801/data" />
[Remoting专题系列] 十二:配置文件        
<activated type="Learn.Library.Remoting.Data2, Learn.Library" />
[Remoting专题系列] 十二:配置文件      
</client>
[Remoting专题系列] 十二:配置文件    
</application>
[Remoting专题系列] 十二:配置文件  
</system.runtime.remoting>
[Remoting专题系列] 十二:配置文件
</configuration>
[Remoting专题系列] 十二:配置文件
[Remoting专题系列] 十二:配置文件Server.cs
[Remoting专题系列] 十二:配置文件RemotingConfiguration.Configure(
"server.config"false);
[Remoting专题系列] 十二:配置文件
[Remoting专题系列] 十二:配置文件Client.cs
[Remoting专题系列] 十二:配置文件RemotingConfiguration.Configure(
"client.config"false);
[Remoting专题系列] 十二:配置文件
[Remoting专题系列] 十二:配置文件Data data 
= new Data();
[Remoting专题系列] 十二:配置文件data.Test();
[Remoting专题系列] 十二:配置文件
[Remoting专题系列] 十二:配置文件Data2 data2 
= new Data2();
[Remoting专题系列] 十二:配置文件data2.Test();
[Remoting专题系列] 十二:配置文件[最后修改由 yuhen

相关文章:

  • 2022-02-27
  • 2021-08-01
  • 2022-12-23
  • 2022-02-06
  • 2021-06-24
  • 2022-01-04
  • 2021-07-23
猜你喜欢
  • 2021-12-14
  • 2021-12-24
  • 2022-02-22
  • 2021-10-11
  • 2022-01-11
  • 2021-11-30
  • 2022-02-18
相关资源
相似解决方案