问题描述
我在服务中设置了标准错误:
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
推荐答案
这篇关于如何处理低级别的WCF错误?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!