Fiddler2 Best program out there I think for debugging WCF errors in silverlight when you get “NotFound” error messages.
Example. I had a Silverlight application where I had to enable it work over https and change the host headers. As many of you may know, WCF on .NET 3.5 you can not bind to website with multiple headers. You have to hardcode the WCF Address in the web.config. (I’ve read that .Net 4.0 will allow this but still not for ssl).
All my setting from what I can tell in my web.config and my clientConfig were correct, and the app worked fine in http mode only, however I would get the most generic message ever.
This is my custom error window I use to have users send the errors to the server. As you can see the error is “The remote server returned an error: NotFound.” this is basically the equivalent of the old server error message “An Unexpected Error Occurred”. Basically who knows. Something’s wrong. The WCF service is not responding. Could be your firewall, your IIS, your service is erroring out or 100 other things.
Download and install Fiddler2 and let the magic begin. I did try WebDevHelper which is like FireBug for FireFox but it works in IE. It’s pretty good, but like FireBug, doesn’t give you that WCF error.
Loading up Fiddler, I can inspect the traffic and actually see the .Net error. It even highlights it in red for me. (Had to block out the app names).
From this I was able to expand the information like below to see the real error message.
“Cannot be process at the receiver, due to an AddressFilter mismatch at the EndpointDispatcher. Check that the sender and receiver’s EndPointAddresses agree”
After I realized what the problem was I was able to fix my service by adding the attribute AddressFilterMode:=AddressFilterMode.Any to my WCF class.
<ServiceContract(Namespace:="")> _
<ServiceBehavior(IncludeExceptionDetailInFaults:=True, AddressFilterMode:=AddressFilterMode.Any)> _
<AspNetCompatibilityRequirements(RequirementsMode:=AspNetCompatibilityRequirementsMode.Allowed)> _
Public Class xxxxxxxxxxxService
Problem Solved.
WCF logging:
You can also log all your WCF Traffic to a Log file on your server.
<system.diagnostics>
<sharedListeners>
<add name="WcfListener"
type="System.Diagnostics.XmlWriterTraceListener"
initializeData="C:\logs\wcfLog.svclog"/>
</sharedListeners>
<sources>
<!-- switchValue attribute has no impact on MessageLogging -->
<source name="System.ServiceModel.MessageLogging">
<listeners>
<add name="WcfListener" />
</listeners>
</source>
<source name="System.ServiceModel"
switchValue="Warning, ActivityTracing"
propagateActivity="true" >
<listeners>
<add name="WcfListener" />
</listeners>
</source>
</sources>
</system.diagnostics>
<system.serviceModel>
<diagnostics>
<messageLogging
logEntireMessage="true"
logMalformedMessages="false"
logMessagesAtServiceLevel="true"
logMessagesAtTransportLevel="false"
maxMessagesToLog="3000"
maxSizeOfMessageToLog="2000"/>
</diagnostics>
</system.serviceModel>
Other useful posts..
Silverlight and WCF – WCF Logs and Debugging
Service Trace Viewer Tool (SvcTraceViewer.exe)
Silverlight & WCF - HTTPS
c6ca759a-0f7f-49c2-b892-3cd71544ad9a|0|.0
WCF, SilverLight, Troubleshooting
wcf, silverlight, https, debug, fiddler