方法 : クライアント側でアクティブ化される型のインスタンスを生成する
クライアント側でアクティブ化される型のインスタンスを作成する方法を、次のコード例に示します。この例では、ポート 8080 でリッスンするように TcpChannel が登録されていると仮定します。
使用例
Dim Object() = {New UrlAttribute("tcp://computername:8080/RemoteObjectApplicationName ")}
' Note that the second parameter (Nothing) specifies that no arguments
' are being passed.
Dim MyRemoteClass As RemoteObjectClass = _
CType( _
Activator.CreateInstance(GetType(RemoteObjectClass), Nothing, url), _
RemoteObjectClass)
object[] url = {new UrlAttribute("tcp://computername:8080/RemoteObjectApplicationName")};
// Note that the second parameter (null) specifies that no arguments
// are being passed.
RemoteObjectClass MyRemoteClass = (RemoteObjectClass)Activator.CreateInstance(
typeof(RemoteObjectClass),
null,
url
);
コードのコンパイル方法
この例では、下記が必要です。
- System および System.Runtime.Remoting.Activation 名前空間、および RemoteObjectClass を実装する名前空間への参照
参照
概念
リモート オブジェクトのアクティべーション
リモート アプリケーションの構成
サーバー アクティベーション
有効期間リース
クライアント アクティベーション