Debugging WCF Web Service Faults
I am trying to debug a web service exception. I have both the client and the service running in debug mode in Visual Studio 2010, C#, .net 4.0 framework.
When I run the client, and get it to call the web service, I get an exception:
Type: System.ServiceModel.FaultException`1[[System.ServiceModel.ExceptionDetail, System.ServiceModel, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]] Error Message: The type initializer for 'myService.Service' threw an exception.
Source: mscorlib
However, the service shows no exceptions whatsoever.
The stack trace that I got seems to indicate that the call was made, and the reply was being handled (even if the reply was an exception):
Server stack trace:
at System.ServiceModel.Channels.ServiceChannel.ThrowIfFaultUnderstood(Message reply, MessageFault fault, String action, MessageVersion version, FaultConverter faultConverter) at System.ServiceModel.Channels.ServiceChannel.HandleReply(ProxyOperationRuntime operation, ProxyRpc& rpc) at System.ServiceModel.Channels.ServiceChannel.Call(String action, Boolean oneway, ProxyOperationRuntime operation, Object[] ins, Object[] outs, TimeSpan timeout) at System.ServiceModel.Channels.ServiceChannelProxy.InvokeService(IMethodCallMessage methodCall, ProxyOperationRuntime operation) at System.ServiceModel.Chan开发者_开发问答nels.ServiceChannelProxy.Invoke(IMessage message)
Can someone give pointers on what else I need to do to debug this?
I'm currently setting up the Service Trace Viewer tool to see if that will tell me anything more.
The error message suggests that your service class myService.Service
has a static constructor or field initializer expression with a bug in it, causing an unhandled exception to escape the static ctor when the Service type is loaded.
In the service host process under the debugger, just put breakpoints on the static ctor and field initializer expressions, and step until the underlying exception occurs.
The Fusion (.NET class loader) Log will likely get you there also, if you know how to use that.
Error is likely a missing dependency on server side. Launch fuslogvw.exe, enable failure logging, reproduce the problem and look for related failure records.
精彩评论