11.15. Register All the Remotable Classes in an Assembly

Problem

You want to register all the remotable classes that are defined in an assembly without having to specify them in a configuration file.

Solution

Load the assembly with the remotable classes using reflection. Loop through all its Public types, and use the RemotingConfiguration.RegisterWellKnownServiceType method to register every remotable class.

How It Works

.NET makes it equally easy to register remotable classes through a configuration file or programmatically with code. The type being registered must extend MarshalByRefObject, and then you call RemotingConfiguration.RegisterWellKnownServiceType, passing on the type, the URI on which remote clients can connect to the type, and ...

Get Visual Basic 2008 Recipes: A Problem-Solution Approach now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.