• 博客园logo
  • 会员
  • 众包
  • 新闻
  • 博问
  • 闪存
  • 赞助商
  • HarmonyOS
  • Chat2DB
    • 搜索
      所有博客
    • 搜索
      当前博客
  • 写随笔 我的博客 短消息 简洁模式
    用户头像
    我的博客 我的园子 账号设置 会员中心 简洁模式 ... 退出登录
    注册 登录

风语者

风中我低语,愈远愈清晰
  • 博客园
  • 联系
  • 管理

公告

View Post

C# 代码标准 .NET2.0版(六)Remoting 编码指导方针

1.Prefer administrative configuration to programmatic configuration.

2.Always implement IDisposable on single-call objects.

3.Always prefer a TCP channel and a binary format when using remoting, unless a firewall is present.

4.Always provide a null lease for a singleton object:

public class MySingleton : MarshalByRefObject
{
   public override object InitializeLifetimeService( )
   {
      return null;
   }
}

 

5.Always provide a sponsor for a client-activated object. The sponsor should return the initial lease time.

6.Always unregister the sponsor on client application shutdown.

7.Always put remote objects in class libraries.

8.Avoid using SoapSuds.exe.

9.Avoid hosting in IIS.

10.Avoid using uni-directional channels.

11.Always load a remoting configuration file in Main( ), even if the file is empty and the application does not use remoting:

static void Main( )
{
   RemotingConfigurationEx.Configure( );
   /* Rest of Main( )  */
}

 

12.Avoid using Activator.GetObject( ) and Activator.CreateInstance( ) for remote object activation. Use new instead.

13.Always register port 0 on the client side, to allow callbacks.

14.Always elevate type filtering to Full on both client and host, to allow callbacks.

 

posted on 2005-08-22 17:21  风语者  阅读(1147)  评论(0)    收藏  举报

刷新页面返回顶部
 
博客园  ©  2004-2025
浙公网安备 33010602011771号 浙ICP备2021040463号-3