クライアント側のリモート処理で使用するインターフェイスアセンブリを動的にロードする必要があります。このようなもの。
static void Main(string[] args)
{
TcpClientChannel clientChannel = new TcpClientChannel();
ChannelServices.RegisterChannel(clientChannel, false);
Assembly interfaceAssembly = Assembly.LoadFile("RemotingInterface.dll");
Type iTheInterface =
interfaceAssembly.GetType("RemotingInterface.ITheService");
RemotingConfiguration.RegisterWellKnownClientType(iTheInterface,
"tcp://localhost:9090/Remotable.rem");
object wellKnownObject = Activator.GetObject(iTheInterface,
"tcp://localhost:9090/Remotable.rem");
}
Activator.GetObjectをキャストできないため、メソッドの呼び出し方法を理解できないようです。コンパイル時にインターフェイスを知らなくても、ITheServiceのプロキシを作成するにはどうすればよいですか?