简体   繁体   English

查找负责WCF通信异常的Web方法

[英]Finding the Web Method responsible for WCF Communication Exception

I'm trying to find the name of the web method(s) (the web application has hundreds of them) that are responsible for throwing intermittent System.ServiceModel.CommunicationException exceptions. 我正在尝试查找负责引发间歇性System.ServiceModel.CommunicationException异常的Web方法(Web应用程序有数百种方法)的名称。

I have an error handler ( IErrorHandler ) that can catch the exception, but the exception information doesn't point me to the source of the exception. 我有一个可以捕获异常的错误处理程序( IErrorHandler ),但是异常信息并未将我指向异常的来源。

Is there any way to determine which web method is responsible for the exception? 有什么方法可以确定哪个Web方法导致异常?

The only stack trace information is the following: 唯一的堆栈跟踪信息如下:

System.ServiceModel.CommunicationException: There was an error reading from the pipe: Unrecognized error 109 (0x6d). System.ServiceModel.CommunicationException:从管道读取错误:无法识别的错误109(0x6d)。 ---> System.IO.PipeException: There was an error reading from the pipe: Unrecognized error 109 (0x6d). ---> System.IO.PipeException:从管道读取错误:无法识别的错误109(0x6d)。
at System.ServiceModel.Channels.PipeConnection.OnAsyncReadComplete(Boolean haveResult, Int32 error, Int32 numBytes) 在System.ServiceModel.Channels.PipeConnection.OnAsyncReadComplete(Boolean haveResult,Int32错误,Int32 numBytes)
--- End of inner exception stack trace --- ---内部异常堆栈跟踪的结尾---
at System.Runtime.AsyncResult.End[TAsyncResult](IAsyncResult result) 在System.Runtime.AsyncResult.End [TAsyncResult](IAsyncResult结果)处
at System.ServiceModel.Channels.TransportDuplexSessionChannel.TryReceiveAsyncResult.End(IAsyncResult result, Message& message) 在System.ServiceModel.Channels.TransportDuplexSessionChannel.TryReceiveAsyncResult.End(IAsyncResult结果,消息和消息)
at System.ServiceModel.Dispatcher.DuplexChannelBinder.EndTryReceive(IAsyncResult result, RequestContext& requestContext) 在System.ServiceModel.Dispatcher.DuplexChannelBinder.EndTryReceive(IAsyncResult结果,RequestContext&requestContext)
at System.ServiceModel.Dispatcher.ErrorHandlingReceiver.EndTryReceive(IAsyncResult result, RequestContext& requestContext) 在System.ServiceModel.Dispatcher.ErrorHandlingReceiver.EndTryReceive(IAsyncResult结果,RequestContext&requestContext)

Thanks 谢谢

It is possible for Visual Studio 2010 to catch the exceptions when you are debugging. 在调试时,Visual Studio 2010可能会捕获异常。 You can catch any set of exceptions or all. 您可以捕获任何一组异常或全部。 it is also possible to enable the catching right before you do the operation that throws the exception. 也可以在执行引发异常的操作之前启用捕获功能。

Assuming you are using visual studio 2010: 假设您正在使用Visual Studio 2010:

  1. In the top menu bar, click debug, next click exceptions. 在顶部菜单栏中,单击“调试”,然后单击“例外”。
  2. Click open the Common language runtime exceptions section. 单击打开“ Common language runtime exceptions部分。
  3. Scroll down until you find System.ServiceModel , click this open as well. 向下滚动,直到找到System.ServiceModel ,也单击此打开。
  4. Add a tick in the checkbox for the corresponding exception 在复选框中为相应的例外添加对号

I would also advise, if possible, to add some kind of logging into the methods that can cause this error. 我还建议,如果可能的话,向可能导致此错误的方法中添加某种日志记录。 This way, it would be easier to pinpoint the location of the problem. 这样,更容易查明问题的位置。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM