Debug WCF Web Service Errors

I am trying to debug a web service exception. I have both a client and a service running in debug mode in the Visual Studio 2010 infrastructure, C #,. Net 4.0.

When I start 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: Type initializer for 'myService.Service' made an exception .
Source: mscorlib

However, the service does not show any exceptions.

I found that the stack trace indicates that the call was made and the response was being processed (even if the response was an exception):

Server Stack Trace:

in System.ServiceModel.Channels.ServiceChannel.ThrowIfFaultUnderstood (message reply, MessageFault error, String action, MessageVersion version, error converter failure error)

in System.ServiceModel.Channels.ServiceChannel.HandleReply (operation ProxyOperationRuntime, ProxyRpc & rpc)

in System.ServiceModel.Channels.ServiceChannel.Call (String action, Boolean oneway, ProxyOperationRuntime operation, Object [] ins, Object [] outs, TimeSpan timeout)

in System.ServiceModel.Channels.ServiceChannelProxy.InvokeService (IMethodCallMessageCall, ProxyOperationRuntime method)

in System.ServiceModel.Channels.ServiceChannelProxy.Invoke (message with message)

Can someone point out pointers to what else do I need to do to debug this?

I am currently setting up the Trace Viewer Service tool to see if it will tell me more.

+4
source share
2 answers

The error message assumes that your class of service myService.Service has a static constructor or a field initializer expression with an error in it, causing the unhandled exception to leave the static ctor when loading the service type.

In the service host process in the debugger, simply place breakpoints on the static expressions of the ctor and field initializer and until the main exception occurs.

The Fusion bootloader (.NET class loader) will most likely also get you there if you know how to use it.

+6
source

The error is probably a missing server-side dependency. Run fuslogvw.exe, enable crash logging, reproduce the problem and find the appropriate crash records.

+2
source

Source: https://habr.com/ru/post/1344009/


All Articles