Fixing a Silverlight 2.0 WCF reference in a VB application

Another in my recent series on getting Silverlight 2.0 beta 2 working.

If you create a WCF web service for Silverlight, it’s well known that on the server side you have to change the binding to basicHttpBinding (or use the new Silverlight-enabled WCF service). Then you can use the Add Reference wizard in your Silverlight application and code against the generated ServiceClient.

This works in C#, but in VB you may hit this error at runtime:

The error is “Could not find endpoint element” etc, and it refers to your “client configuration section”.

I fixed this by comparing the ServiceReferences.ClientConfig file generated in a VB project with that for a C# project. Check the Contract attribute of the endpoint element. It should be qualified with the full namespace, by default the name of your app. In this example, it would be:

contract="RegSilverlightDemoApp.RegService.IRegService"

However, the VB wizard omits the first part of the namespace; then at runtime, it can’t find the service.

Evidence, perhaps, that C# is the language of choice in Microsoft’s developer division.

VN:F [1.9.18_1163]
Rate this post
Rating: 0.0/10 (0 votes cast)

Related posts:

  1. Silverlight developer reference poster shows off DeepZoom
  2. A Silverlight database application with image upload
  3. Silverlight in Microsoft products – Silverlight the new Windows runtime, HTML 5 the new Silverlight?
  4. The desktop versus web application debate
  5. Silverlight 2.0 is released, Eclipse tools for Silverlight announced

3 comments to Fixing a Silverlight 2.0 WCF reference in a VB application