I have a WCF service (using HTTP binding) that our WinForm and WFP apps can use with no problem. We have a Silverlight 4 developer who is saying he's not able to use the WCF service because it needs to be "reconfigured" for Silverlight use. I don't know if this is true or not, because I don't know anything about Silverlight.
So, my question is this. Should a WCF service, that uses HTTP binding,开发者_运维技巧 that is successfully being used by our WinForms and WPF applications, also be able to be consumed by Silverlight apps, without modifying or reconfiguring the WCF service?
Silverlight 4 supports the following bindings:
BasicHttpBinding
PollingDuplexHttpBinding
CustomBinding (with a subset of binding elements)
Silverlight and WCF Feature Comparison:
There are several ways to use the WCF client stack to access a service.
It is used when invoking services through automatically generated proxies, as described in How to: Access a Service from Silverlight. The proxy must be generated in this procedure by using the Add Service Reference tool in Visual Studio 2010 for the Silverlight project.
Caution:
Proxies generated by using the WCF Svcutil.exe tool will not work in Silverlight 4. Use the SLsvcutil.exe tool instead. For more information about using this Silverlight tool, see Using SLsvcUtil.exe to Access a Service.
If you already have a Windows Communication Foundation (WCF) service contract definition, you can use the generic ChannelFactory class without having to generate a proxy. This might be the case, for example, if your client is sharing service definition code with the project on the server. In this case you could, for example, define a service contract interface IStockQuoteService and then use the same IStockQuoteService code in both the server and Silverlight projects. This would involve using a ChannelFactory. This advanced technique is demonstrated in How to: Call Operations Asynchronously Using a Channel Factory and in the Silverlight 4 context with Building and Accessing Duplex Services. For more information about defining and using service contracts, see Designing Service Contracts.
精彩评论