简体   繁体   中英

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.

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.

Is there any way to determine which web method is responsible for the exception?

The only stack trace information is the following:

System.ServiceModel.CommunicationException: There was an error reading from the pipe: Unrecognized error 109 (0x6d). ---> System.IO.PipeException: There was an error reading from the pipe: Unrecognized error 109 (0x6d).
at System.ServiceModel.Channels.PipeConnection.OnAsyncReadComplete(Boolean haveResult, Int32 error, Int32 numBytes)
--- End of inner exception stack trace ---
at System.Runtime.AsyncResult.End[TAsyncResult](IAsyncResult result)
at System.ServiceModel.Channels.TransportDuplexSessionChannel.TryReceiveAsyncResult.End(IAsyncResult result, Message& message)
at System.ServiceModel.Dispatcher.DuplexChannelBinder.EndTryReceive(IAsyncResult result, RequestContext& requestContext)
at System.ServiceModel.Dispatcher.ErrorHandlingReceiver.EndTryReceive(IAsyncResult result, RequestContext& requestContext)

Thanks

It is possible for Visual Studio 2010 to catch the exceptions when you are debugging. 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:

  1. In the top menu bar, click debug, next click exceptions.
  2. Click open the Common language runtime exceptions section.
  3. Scroll down until you find System.ServiceModel , click this open as well.
  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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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