I noticed from Scott Guthrie's blog that he claims that Silverlight can be used to call WCF web services hosted within ASP.NET. I think the critical part of this statement must be that the web service must be hosted within ASP.NET since I can't find any way of directly interacting with WCF from Silverlight due to the subset of the CLR available. Has anyone else tried to do this, or know where there might be a nice example of doing this?
A bit later...
OK, I've managed to make some progress. I can create a WCF service which is hosted within ASP.NET. I can create a service reference and call the service from a Windows Forms application, so I'm happy that the service is running OK. However, I can't call the service from Silverlight. If I add it as a web reference and then try to call my method on it I get a (very helpful) error which states 'Error invoking service'. If I create a BrowserHttpWebRequest http://localhost/test/test.svc/Hello, or try the same thing in a browser, the response I get is:
- <Fault xmlns="http://schemas.microsoft.com/ws/2005/05/envelope/none">
<Value xmlns:a="http://schemas.microsoft.com/ws/2005/05/addressing/none">a:DestinationUnreachable</Value>
</Subcode>
</Code>
<Text xml:lang="en-US">The message with To
'http://localhost/test/test.svc/Hello' cannot be processed at the
receiver, due to an AddressFilter mismatch at the EndpointDispatcher. Check that
the sender and receiver's EndpointAddresses agree.</Text>
</Reason>
</Fault>
I think this is something to do with the SOAP headers not being created correctly?
Has anyone else seen this problem, or have any ideas how to fix it?