使用 .NET Remoting 时如何捕获未处理的异常

发布于 2024-07-04 21:46:12 字数 133 浏览 5 评论 0 原文

我想捕获服务器上远程对象中抛出的所有未处理的异常,并在将它们转换为某些自定义异常之前将它们记录在那里,以便特定异常不会跨越客户端/服务器边界。

我想我必须使用自定义频道同步,但是任何人都可以确认这一点和/或有任何其他建议可以提供吗?

I want to catch all unhandled exceptions thrown in a remote object on the server and log them there before I translate them into some custom exception so that specific exceptions do not cross the client/server boundary.

I think I have to use a custom channel sync, but can anyone confirm this and/or have any other advice to give?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

幽梦紫曦~ 2024-07-11 21:46:12

在找到Eliyahu Baker的有用的博客文章并阅读Rammer 的高级 .NET 远程处理 我编写了一个自定义通道接收器,可以执行我想要的操作。 这会拦截任何异常并将其记录在本地,然后再将其发送到客户端。

理想情况下,我想记录异常并为客户提出一个更通用的异常,但我还没有解决这个问题。

After finding Eliyahu Baker's helpful blog post and reading chapter 12 of Rammer's Advanced .NET Remoting I wrote a custom channel sink that does what I want. This intercepts any exception and logs it locally before sending it on to the client.

Ideally, I'd like to log the exception and raise a more generic one for the client, but I haven't cracked that nut yet.

岁月打碎记忆 2024-07-11 21:46:12

我将使用 Microsoft Enterprise Library 异常处理应用程序块 - 它允许您处理错误并在重新抛出到客户端之前将特定类型的异常转换为不同类型的异常。

I would use the Microsoft Enterprise Library Exception Handling app block -- it lets you handle errors and convert specific types of exception to a different type of exception before rethrowing to the client.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文