How to add extended information to a .Net Remoting call without adding new parameters on the calls?
I am working with a large existing .Net Remoting service. This service needs to be modified in a way that all calls to the service need additional information to allow the service to process the calls correctly.
I would like to avoid adding a new parameter onto each of the existing functions, and would prefer to pass extended information from the client to 开发者_StackOverflowthe server in a way that leaves the interfaces unchanged and still allows the service to process the calls correctly.
This can be accomplished using the following interfaces: IClientChannelSink, IClientChannelSinkProvider, IServerChannelSink, and IServerChannelSinkProvider
Using these interfaces, a client sink can be created, which can add the new global information onto each call as a header value, and the server sink can pull this header value off, and store it for usage by the logic code.
You can find a high level overview of these at http://www.diranieh.com/NETRemoting/ExtendingNET.htm
The client config section to enable your client sink is:
<system.runtime.remoting> <application> <channels> <channel ref="tcp" port="0" encryption="EncryptAndSign"> <clientProviders> <provider type="Namespace.ClientSinkProvider, dll"/> </clientProviders> </channel> </channels> </application> </system.runtime.remoting>
The server config section to enable your server sink is:
<system.runtime.remoting> <application> <channels> <channel ref="tcp" port="0" encryption="EncryptAndSign"> <serverProviders> <provider type="Namespace.ServerSinkProvider, dll" /> </serverProviders> </channel> </channels> </application> </system.runtime.remoting>
精彩评论