private static void p_Server(object serverObject) { try { RemotingServer server = (RemotingServer)serverObject; // To this sample, I will require cryptography, and will only // accept RijndaelManaged and TripleDES. If I don't register a // valid cryptography, all cryptographies are valid. server.CryptographyMode = CryptographyMode.Required; server.RegisterAcceptedCryptography <RijndaelManaged>(); server.RegisterAcceptedCryptography <TripleDESCryptoServiceProvider>(); // Here I register the valid classes that the client can create // directly. //server.Register(typeof(IServer), typeof(SecureChat.Server.Server)); server.Register(typeof(SecureChat.Common.IServer), typeof(SecureChat.Server.Server)); // Here I start the server. server.Run(570); } catch (ObjectDisposedException) { // If during initialization the user press ENTER and disposes the // server, I will simple ignore the exception and finish the thread. } }