I have a WPF client that is attached to WCF endpoint on a very simple ISS application. I would like connect a Silverlight application to the same WCF service. I’ve read that I have to enable OData. Is this still necessary in 4? If so, how do I do it? How do I actually connect the endpoints? Do I need to use RIA services to facilitate the connection? Can I use the same IIS application to provide both endpoints?
Thanks in advance for any help. This one has me stumped.
Edits:
Below is the configuration for my WCF Service and my Silverlight Client.
WCF Server Configuration (obfuscated):
<system.serviceModel>
<bindings>
<wsHttpBinding>
<binding maxReceivedMessageSize="2147483647">
<security mode="Transport">
<transport clientCredentialType="None"/>
</security>
</binding>
</wsHttpBinding>
<basicHttpBinding>
<binding maxReceivedMessageSize="2147483647">
<security mode="Transport">
<transport clientCredentialType="None"/>
</security>
</binding>
</basicHttpBinding>
</bindings>
<services>
<service name="MyNamespace.Services.MyService">
<endpoint contract="MyNamespace.ServiceContracts.IMyService"
address=""
binding="wsHttpBinding"
/>
<endpoint contract="MyNamespace.ServiceContracts.IMyService"
address="basic"
binding="basicHttpBinding"
/>
<endpoint contract="IMetadataExchange"
address="mex"
binding="mexHttpBinding"
/>
</service>
</services>
<behaviors>
<serviceBehaviors>
<behavior>
<serviceMetadata httpGetEnabled="True" />
<serviceDebug includeExceptionDetailInFaults="False" />
</behavior>
</serviceBehaviors>
</behaviors>
</system.serviceModel>
Silverlight Client Side Configuration (obfuscated):
<system.serviceModel>
<bindings>
<basicHttpBinding>
<binding name="Binding.Secure" maxReceivedMessageSize="2147483647" maxBufferSize="2147483647">
<security mode="Transport" />
</binding>
</basicHttpBinding>
</bindings>
<client>
<endpoint name="MyServiceReferenceNamespace.MyService"
contract="MyServiceReferenceNamespace.IMyService"
address="https://www.mydomain.com/MyVirtualDirectory/MyContract.svc"
binding="basicHttpBinding"
bindingConfiguration="Binding.Secure"
/>
</system.serviceModel>
(The names have been changed to protect my clients.)
You don’t need to enable OData; as long as the endpoint in your existing service uses a binding which is compatible with Silverlight (for example, BasicHttpBinding), the SL app will be able to consume it just as well as the WPF one. If the binding is not compatible, you can add a new endpoint to the service (yes, it can be in the same IIS application) which can be used by the SL application.
In your SL project, you can choose “Add Service Reference”, and that will create a proxy in that project which knows how to “talk” to the WCF service.