I have a Silverlight application in which I would like to call a WCF service. When calling the service I receive the following response from the server:
Probably the service is throwing an exception. The exception message is not in the format expected by the service call, hence the "not the expected type" message.
If the method called is not throwing an exception internally, check your security settings for the service or the other configuration items, per Marc Gravell's helpful answer.
There are a couple of ways to examine the exception: Looking at the exception message in detail, or tracing the WCF service calls.
To see the exception message put a try-catch around the service call and set a breakpoint in the catch block. This will allow you to examine the exception contents. You may want to configure the service temporarily to include exception details in the fault message.
You can trace WCF messages easily by enabling message logging for the service. You can do this in the config file (see Configuring Message Logging) or using the WCF Service Configuration Editor (available under VS 2008 Tools menu or by right clicking the config file). Then use the Service Trace Viewer to browse the log file. The viewer is part of the SDK and may be found here: "C:\Program Files\Microsoft SDKs\Windows\v6.0A\bin\SvcTraceViewer.exe"
.