如何向 .Net Remoting 调用添加扩展信息而不在调用中添加新参数?
我正在使用现有的大型 .Net Remoting 服务。该服务需要修改为所有对该服务的调用都需要附加信息以允许该服务正确处理这些调用。
我希望避免向每个现有函数添加新参数,并且更愿意以保持接口不变且仍允许服务正确处理调用的方式将扩展信息从客户端传递到服务器。
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 the server in a way that leaves the interfaces unchanged and still allows the service to process the calls correctly.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
这可以使用以下接口来完成:
IClientChannelSink、IClientChannelSinkProvider、IServerChannelSink 和 IServerChannelSinkProvider
使用这些接口,可以创建客户端接收器,该客户端接收器可以将新的全局信息作为标头值添加到每个调用中,并且服务器接收器可以提取该标头值并将其存储以供使用通过逻辑代码。
您可以在 http://www.diranieh.com/NETRemoting/ExtendingNET 找到这些内容的高级概述.htm
启用客户端接收器的客户端配置部分是:
启用服务器接收器的服务器配置部分是:
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:
The server config section to enable your server sink is: