Missing channel sink
Hello I am writing a project, which uses .NET Remoting and Observer pattern.
Server:
BinaryClientFormatterSink开发者_Go百科Provider clientProv = new BinaryClientFormatterSinkProvider();
BinaryServerFormatterSinkProvider serverProv = new BinaryServerFormatterSinkProvider();
serverProv.TypeFilterLevel = System.Runtime.Serialization.Formatters.TypeFilterLevel.Full;
IDictionary props = new Hashtable();
props["port"] = 51317;
props["typeFilterLevel"] = System.Runtime.Serialization.Formatters.TypeFilterLevel.Full;
props["name"] = "ServerChannel";
TcpChannel channel = new TcpChannel(props, clientProv, serverProv);
ChannelServices.RegisterChannel(channel, false);
RemotingConfiguration.RegisterWellKnownServiceType(typeof(Tracker.Bl.Account.AccountManager), "AccountManager", WellKnownObjectMode.SingleCall);
RemotingConfiguration.RegisterWellKnownServiceType(typeof(Tracker.Bl.Account.AccountFVO), "AccountFVO", WellKnownObjectMode.SingleCall);
RemotingConfiguration.RegisterWellKnownServiceType(typeof(Tracker.Bl.Project.ProjectItemTracker), "ProjectItemTracker", WellKnownObjectMode.Singleton);
Client:
this.thisUserId = userId;
this.instName = "Dev" + userId.ToString();
this.tracker = (ProjectItemTracker)Activator.GetObject(typeof(Tracker.Bl.Project.ProjectItemTracker), "tcp://localhost:51317/ProjectItemTracker");
this.Subscribe(this.tracker);
BinaryClientFormatterSinkProvider clientProv = new BinaryClientFormatterSinkProvider();
BinaryServerFormatterSinkProvider serverProv = new BinaryServerFormatterSinkProvider();
serverProv.TypeFilterLevel = System.Runtime.Serialization.Formatters.TypeFilterLevel.Full;
IDictionary props = new Hashtable();
props["port"] = 51318;
props["typeFilterLevel"] = System.Runtime.Serialization.Formatters.TypeFilterLevel.Full;
props["name"] = "ClientChannel";
TcpChannel channel = new TcpChannel(props, clientProv, serverProv);
ChannelServices.RegisterChannel(channel, false);
RemotingConfiguration.RegisterWellKnownClientType(typeof(Tracker.Bl.Project.ProjectItemFVO), "ProjectItemFVO");
Now when I do an update with the "admin" user notifications should be sent out:
ProjectItemFVO loc = (ProjectItemFVO)Activator.GetObject(typeof(Tracker.Bl.Project.ProjectItemFVO), "tcp://localhost:51318/ProjectItemFVO");
this.tracker.ProjectItemsChanged(loc);
However when the ProjectItemsChanged
event is handled:
foreach (var observer in observers) {
observer.OnNext(loc);
}
It gives me an error saying: This remoting proxy has no channel sink which means either the server has no registered server channels that are listening, or this application has no suitable client channel to talk to the server.
What am I doing wrong?
精彩评论