如何在使用跨应用程序域远程处理时注入客户端通道接收器(或以其他方式解决我的问题)
在上一篇文章中,我遇到了 LogicalCallContext 数据的问题,这些数据不是也不应该是可序列化的,并且对远程调用造成了严重破坏。我通过实现客户端通道接收器来去除调用上下文数据来解决该问题。我现在遇到了几乎相同的问题,只不过远程调用是在同一进程中对另一个 AppDomain 进行的,使用的经典代码如下所示:
var remoteDomain = AppDomain.CreateDomain("SomeDomain", null, appDomainSetup);
var serviceProxy = (IMyService)remoteDomain.CreateInstanceAndUnwrap(serviceType.Assembly.FullName, serviceType.FullName);
当前问题的另一个警告是调用数据正在被放置使用我的代码的客户端程序集的上下文,因此我无法控制它是否存在。
目前问题的症结在于,据我所知,用于跨应用程序域远程处理的通道接收器链被硬编码到.Net 中。因此,无法注入我开发的作为原始问题解决方案的 CallContextSaninitization 接收器。
那么有谁知道更好的方法来解决原始问题,或者在使用跨AppDomain远程处理时注入客户端通道接收器的方法?
In a previous post, I had problems with LogicalCallContext data that was not and should not be serializable and which was wreaking havoc with remoting calls. I solve the problem by implementing a client channel sink to strip out the call context data. I now have a virtually identical problem, except that the remoting call is being made to another AppDomain within the same process, using the classic code for this that looks like so:
var remoteDomain = AppDomain.CreateDomain("SomeDomain", null, appDomainSetup);
var serviceProxy = (IMyService)remoteDomain.CreateInstanceAndUnwrap(serviceType.Assembly.FullName, serviceType.FullName);
An additional caveat to the current problem is that the call data is being placed on the context by the client assembly that is using my code, so I don't have any control over it being there or not.
The crux of the current problem then is that, to my knowledge, the channel sink chain used for cross-app-domain remoting is hard coded into .Net. Consequently, there is no way to inject the CallContextSaninitization sink that I developed as the solution to original problem.
So does anyone know of a better way to solve the original problem, or a way to inject a client channel sink when using cross-AppDomain remoting?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论