From .NET Framework document, you can have multiple channels as long as they have different names. It has nothing to do with the channel type. Actually, its the architecture problem prevent you from using the right channel. When you create a remote proxy using Activator.GetObject, you can't specify which channel you want to use, Instead, it's RemotingServices's duty to figure it out. It would go through all registered channel provider chain to ask whether the object url is acceptable for the provider. If one of those providers chooses to accept the object url and creates the channel sinks, remoting services will not ask the rest ones. For all http client channel (it's actually a provider), they will simply parse the url, if it starts with http:// and all other sink providers in the same chain has no objection, then the provider will accept the object creation. For formatters like SoapClientFormmatterSinkProvider and BinaryClientFormatterSinkProvider, they have no idea on what's the right format the remote object really use, so they will never reject any object creation. In your code, you registered two http channels, while they both could accept urls starts with http://. So if unfortunatly you are using the one with wrong formatter sink, an exception will be thrown at server side.
One way to solve this is create your own Channel Sink Provider, which does nothing but simply judges whether to accept the object url based on naming convention. For example, all urls end with ".rem" are supposed to be binary format, while urls end with ".soap" are supposed to be soap format. Then put your provider in the chain: HttpClientChannel -> SoapClientFormatterSinkProvider -> MyFormatSinkProvider(".soap") HttpClientChannel -> BinaryClientFormatterSinkProvider -> MyFormatSinkProvider(".rem") Then, if the remote object is properly named with the right convention, you would get a chance to judge whether to accept the url or pass it to the next channel sink provider. Best Regards Ming Chen -----Original Message----- From: Mike Woodring [mailto:[EMAIL PROTECTED]] Sent: Wednesday, May 29, 2002 4:54 PM To: [EMAIL PROTECTED] Subject: Re: [ADVANCED-DOTNET] remoting with http/soap and http/binary channels within the same client app instance ----- Original Message ----- From: "Chris Keyser" <[EMAIL PROTECTED]> > > 1) Is it legitimate to run both http binary and soap channels within the > same client instance? As far as I can tell, this should not pose a problem. > You can't register the same channel type more than once in a given app domain. I'm surprised your code works as far as it does. Usually, you get a "channel has already been registered" exception if you try to register the same channel type more than once in a given app domain. However, you can register the same channel type in different app domains - as long as you use a different port for each channel. This way (for example) clients that connect to port X know that they need to use http/binary, while clients that connect to port Y know that they need to use http/soap. I have some sample code (C#) I can send you offline if you're interested. -Mike http://staff.develop.com/woodring http://www.develop.com/devresources You can read messages from the Advanced DOTNET archive, unsubscribe from Advanced DOTNET, or subscribe to other DevelopMentor lists at http://discuss.develop.com. You can read messages from the Advanced DOTNET archive, unsubscribe from Advanced DOTNET, or subscribe to other DevelopMentor lists at http://discuss.develop.com.