Click here to Skip to main content
15,886,199 members
Articles / Programming Languages / C#

.NET Remoting Customization Made Easy: Custom Sinks

Rate me:
Please Sign up or sign in to vote.
4.86/5 (77 votes)
20 May 200320 min read 211K   2.2K   97  
.NET Remoting customization – it doesn't have to be so hard!
//
// Written by Motti Shaked
//
// motti@wincode.net
//
// Version: 1.0.0.0
//
// DISCLAIMER:
//
// You may use this code as you please.
// You may modify and share it freely.
// You may NOT hold me liable for any damage
// caused to you, your company, your neighbors,
// or anyone else as a result of using this code,
// taking ideas from it, dreaming of it,
// or any other use you may find it suitable for.
// Whatever you do with this code is at 
// your own risk.
//
// Enjoy!
// 

using System;
using System.Runtime.Remoting;

using ClientServerSharedTypes;

namespace SampleClient
{
	class Class1
	{
		static void Main(string[] args)
		{
			// note:
			// this assembly has a reference to the CusotomSinks and SampleSinks assembly.
			// these references are unnecessary and are set just for convenience, as the
			// Visual Studio will copy them to the bin\debug, where they are needed in runtime.

			//
			// uncomment the appropriate Configure line below
			//

			// work with LameEncryptionClientSink
			RemotingConfiguration.Configure("Basic_SampleClient.exe.config");

			// work with EnhancedLameEncryptionClientSink
			//RemotingConfiguration.Configure("Enhanced_SampleClient.exe.config");

			// work with DemoCredentialClientSink
			//RemotingConfiguration.Configure("Credentials_SampleClient.exe.config");

			IService service = (IService)Activator.GetObject(typeof(IService), "http://localhost:7878/Service");

			// invoking the service
			service.DoSomething("Some parameter data");
		}
	}
}

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here


Written By
Software Developer (Senior)
Canada Canada
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.

Comments and Discussions