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.

3 thoughts on “Fixing a Silverlight 2.0 WCF reference in a VB application”

  1. Thanks A Lot for the post. I was geeting the exact same error and was trying to fix it for the last two days.
    Reny

Comments are closed.