本来网上看了remoting信道的原理,并做了个Demo,可是怎么都不能将自己的sink挂到remoting的信道中,有知道的支个招。或者有这方面可以运行的源码也行。
我的代码如下:
在client.config中
<channels>
<channel ref="tcp client" />
<clientProviders>
<formatter ref ="binary"/>
<provider type ="TimeClient.myClientSinkProvider, TimeClient"/>
</clientProviders>
</channels>在Server.config中
<channels>
<channel ref="tcp server" port="1234" />
<serverProviders>
<provider ref="wsdl" />
<formatter ref="binary"/>
<provider type="TimeServer.myServerSinkProvider, TimeServer"/>
</serverProviders>
</channels>
好像自定义的sink是没有问题的,但是一直跟踪不到。
我的代码如下:
在client.config中
<channels>
<channel ref="tcp client" />
<clientProviders>
<formatter ref ="binary"/>
<provider type ="TimeClient.myClientSinkProvider, TimeClient"/>
</clientProviders>
</channels>在Server.config中
<channels>
<channel ref="tcp server" port="1234" />
<serverProviders>
<provider ref="wsdl" />
<formatter ref="binary"/>
<provider type="TimeServer.myServerSinkProvider, TimeServer"/>
</serverProviders>
</channels>
好像自定义的sink是没有问题的,但是一直跟踪不到。
{
RemotingConfiguration.Configure (AppDomain.CurrentDomain.BaseDirectory+"\\"+"TimeClient.exe.config",false); Clock.Clock aa = (Clock.Clock)Activator.GetObject(typeofClock.Clock) , "tcp://localhost:1234/Clock" );
string bb = aa.GetCurrentTime();
Console.WriteLine(aa.GetCurrentTime());
}
客户端的调用
<wellknown type="Remoting.RemoteObject,RemoteObject" url="tcp://localhost:6791/CallbackSample" />
</client>
<channels>
<channel ref="tcp" port="0">
<serverProviders>
<provider ref="binary" typeFilterLevel="Full" />
</serverProviders>
</channel>
</channels>
<service>
<!--<activated type="Remoting.RemoteObject,
RemoteObject" />-->
<wellknown mode="Singleton" type="Remoting.RemoteObject,
RemoteObject" objectUri="CallbackSample" />
</service>
<channels>
<channel ref="tcp" port="6791">
<serverProviders>
<provider ref="binary" typeFilterLevel="Full" />
</serverProviders>
</channel>
</channels>
你的配置文件明显不行,都没有把自定义的sink(即TimeClient.myClientSinkProvider等)配置进去。我是按照:http://www.cnblogs.com/idior/archive/2007/01/09/611265.html 上的图2结构写的。
不过想看看你的Demo,麻烦发一下,谢谢! [email protected]