Question:
Are there known issues making calls to a service that calls another service from Silverlight?
Scenario:
I have the following 3 projects:
SilverlightClient - Silverlight project with a Button
SilverlightClient.Web - A web application that hosts the SilverlightClient.xap.
BackEnd - A different web application that hosts the FOO Service which does some special backend processing.
I have created a Silverlight WCF-Enabled web service in both SilverlightClient.Web and Backend. These are respectively SilverlightClientService and BackEndService.
From SilverlightClient.Web I add a service reference to BackEndService. I have a test ASPX page that I've written code that calls BackEndService successfully.
From SilverlightClient I add a service reference to SilverlightClient.Web's SilverlightClientService. If my SilverlightClientService returns plain data, such as a string, it works quite well.
The moment, however, that I change SilverlightClientService to call BackEndService, I get the following exception:
HTTP 415 - "The request failed with HTTP status 415: Unsupported Media Type."
I had an issue with 2 services not communicating. We finally figured out that using Cassini (the built in Visual Studio IIS) to host the ListenerService 'BackEnd' was causing the problem. Switching the project to start in a virtual directory of IIS allowed the two to communicate.
I was seeing : An error occurred while receiving the HTTP response to http://localhost:1484/MainListenerService.cs. This could be due to the service endpoint binding not using the HTTP protocol. This could also be due to an HTTP request context being aborted by the server (possibly due to the service shutting down). See server logs for more details. and this error: The HTTP request was forbidden with client authentication scheme 'Anonymous'.
Are you using basicHttpBinding? Silverlight only supports basicHttpBinding but the default when you create a WCF service is wsHttpBinding. You should change that on your web.config before adding the reference on your Silverlight project. Check out this video from Tim Heuer: http://silverlight.net/learn/videos/all/how-to-consume-wcf-and-aspnet-web-services-in-silverlight/
精彩评论