如何处理低级别的WCF错误? [英] How to handle low level WCF errors?

查看:76
本文介绍了如何处理低级别的WCF错误?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在服务中设置了标准错误:

I have the standard error handing in place in my service:

  • 我有一个连接到服务的IErrorHandler来处理服务执行期间的意外错误.
  • 我在所有服务方法中都有try/catch块来处理预期的情况.

但是,在某些情况下,服务器上会抛出异常而没有被调用.

However, there are cases where exceptions are thrown on the server and neither is called.

在这种情况下,服务器异常未发送到IErrorHandler:

Here is a case where the server exception is not sent to the IErrorHandler:

  • 将服务器绑定上的receiveTimout设置为5 .

在客户端上执行以下操作:

On the client do this:

Service1Client sc = new Service1Client();
ICommunicationObject o = sc as ICommunicationObject;

o.Open(); // open channel

sc.GetData(10); // do a first call

Thread.Sleep(10000); // wait longer than the server receiveTimeout

sc.GetData(10); // Attempt another call: server throws a FaulException

 

In that case, the error is thrown on the server but I cannot find a way to handle it (and log it). I know an error is raised because if I attach a debugger on the server process and break on all exceptions, the debugger breaks.

In that case, the error is thrown on the server but I cannot find a way to handle it (and log it). I know an error is raised because if I attach a debugger on the server process and break on all exceptions, the debugger breaks.

I have found other similar cases where low level errors are not passed to my program.

I have found other similar cases where low level errors are not passed to my program.

Where can I hook my code to ensure that I can handle ALL exceptions that occur on the server before they are returned to the client app? Should I implement my own IChannel or some other low level interface?

Where can I hook my code to ensure that I can handle ALL exceptions that occur on the server before they are returned to the client app? Should I implement my own IChannel or some other low level interface?

Thanks

推荐答案

IErrorHandler应该只适用于这种情况.
请问您能不能对此问题发表一些简短的说明.
IErrorHandler should just work for such a scenario.
can you please post a small working repro of this problem.


这篇关于如何处理低级别的WCF错误?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆