Remoting config file
-
I'm trying to move from programmatic configuration of remoting to using a config file, but I can't seem to get the config file to work. Here's the relevant programmatic code (server side)...
BinaryServerFormatterSinkProvider serverProv = new BinaryServerFormatterSinkProvider(); serverProv.TypeFilterLevel =System.Runtime.Serialization.Formatters.TypeFilterLevel.Full; BinaryClientFormatterSinkProvider clientProv = new BinaryClientFormatterSinkProvider(); IDictionary props = new Hashtable(); props["port"] = 8000; // Create and register an TCP channel TcpChannel serviceChannel = new TcpChannel(props, clientProv, serverProv); ChannelServices.RegisterChannel(serviceChannel, true); // Expose an object AccountConnectionService service = new AccountConnectionService(); RemotingServices.Marshal(service, "myService", typeof(IAccountConnectionService));
This works just fine. Here's my .config file...configuration system.runtime.remoting application service wellknown type="Common.AccountConnectionService,Common" mode="Singleton" objectUri="myService" wellknown service channels channel ref="tcp" port="8000" channels serverproviders formatter ref="binary" typefilterlevel="Full" serverproviders clientprovider formatter ref="binary" typefilterlevel="Full" clientprovider application system.runtime.remoting configuration
This doesn't work. It throws an "Authentication Exception" because the transport connection was closed. I'm not sure what the difference is or what I'm missing. I checked out the MSDN documentation, but tbh I couldn't make heads or tails of it. (I've cobbled this config together from various tutorials.) I don't think this should matter, but I'm still using programmatic configuration on the client side, I can post that code also if it helps. Any help is much appreciated. BW p.s. I apologize for the config looking ugly. The xml was getting messed up in the post, and I couldn't figure out how to make it look right. -
I'm trying to move from programmatic configuration of remoting to using a config file, but I can't seem to get the config file to work. Here's the relevant programmatic code (server side)...
BinaryServerFormatterSinkProvider serverProv = new BinaryServerFormatterSinkProvider(); serverProv.TypeFilterLevel =System.Runtime.Serialization.Formatters.TypeFilterLevel.Full; BinaryClientFormatterSinkProvider clientProv = new BinaryClientFormatterSinkProvider(); IDictionary props = new Hashtable(); props["port"] = 8000; // Create and register an TCP channel TcpChannel serviceChannel = new TcpChannel(props, clientProv, serverProv); ChannelServices.RegisterChannel(serviceChannel, true); // Expose an object AccountConnectionService service = new AccountConnectionService(); RemotingServices.Marshal(service, "myService", typeof(IAccountConnectionService));
This works just fine. Here's my .config file...configuration system.runtime.remoting application service wellknown type="Common.AccountConnectionService,Common" mode="Singleton" objectUri="myService" wellknown service channels channel ref="tcp" port="8000" channels serverproviders formatter ref="binary" typefilterlevel="Full" serverproviders clientprovider formatter ref="binary" typefilterlevel="Full" clientprovider application system.runtime.remoting configuration
This doesn't work. It throws an "Authentication Exception" because the transport connection was closed. I'm not sure what the difference is or what I'm missing. I checked out the MSDN documentation, but tbh I couldn't make heads or tails of it. (I've cobbled this config together from various tutorials.) I don't think this should matter, but I'm still using programmatic configuration on the client side, I can post that code also if it helps. Any help is much appreciated. BW p.s. I apologize for the config looking ugly. The xml was getting messed up in the post, and I couldn't figure out how to make it look right.Well, no replies so far...maybe a different question... Does anyone know where to find a *thorough* tutorial/article on using a .config file for remoting? And please don't say "just do a search, there are plenty out there," because every one I've seen so far is most certainly NOT thorough. Even the articles I've found on MSDN generally only touch on a few of the possible configuration features. The doc on the schema of configuring for remoting is also noticeably out of date. If someone could point me to one they already know of, though, that would be very much appreciated. That said, if I don't get an answer here or elsewhere...I've got Rammer's book on the way, so hopefully I'll find what I need in there (but an earlier answer would be nice :) ). Thanks for any help. BW