{"id":666,"date":"2008-06-09T12:49:29","date_gmt":"2008-06-09T11:49:29","guid":{"rendered":"http:\/\/www.itwriting.com\/blog\/?p=666"},"modified":"2008-06-09T12:49:29","modified_gmt":"2008-06-09T11:49:29","slug":"fixing-silverlight-20-wcf-reference-in-a-vb-application","status":"publish","type":"post","link":"https:\/\/www.itwriting.com\/blog\/666-fixing-silverlight-20-wcf-reference-in-a-vb-application.html","title":{"rendered":"Fixing a Silverlight 2.0 WCF reference in a VB application"},"content":{"rendered":"<p>Another in my recent series on getting Silverlight 2.0 beta 2 working.<\/p>\n<p>If you create a WCF web service for Silverlight, it\u2019s 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. <\/p>\n<p>This works in C#, but in VB you may hit this error at runtime:<\/p>\n<p><img decoding=\"async\" src=\"http:\/\/www.itwriting.com\/images\/vbsilverlighterror.gif\" \/> <\/p>\n<p>The error is \u201cCould not find endpoint element\u201d etc, and it refers to your \u201cclient configuration section\u201d.<\/p>\n<p>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:<\/p>\n<blockquote>\n<p>contract=&quot;RegSilverlightDemoApp.RegService.IRegService&quot;<\/p>\n<\/blockquote>\n<p>However, the VB wizard omits the first part of the namespace; then at runtime, it can\u2019t find the service.<\/p>\n<p>Evidence, perhaps, that C# is the language of choice in Microsoft\u2019s developer division.<\/p>\n<div class=\"wlWriterSmartContent\" id=\"scid:0767317B-992E-4b12-91E0-4F059A8CECA8:5ceec0ad-4ae7-4c2c-8650-814954a1a65b\" style=\"padding-right: 0px; display: inline; padding-left: 0px; float: none; padding-bottom: 0px; margin: 0px; padding-top: 0px\">Technorati tags: <a href=\"http:\/\/technorati.com\/tags\/silverlight\" rel=\"tag\">silverlight<\/a>, <a href=\"http:\/\/technorati.com\/tags\/vb\" rel=\"tag\">vb<\/a>, <a href=\"http:\/\/technorati.com\/tags\/wcf\" rel=\"tag\">wcf<\/a>, <a href=\"http:\/\/technorati.com\/tags\/visual+studio\" rel=\"tag\">visual studio<\/a>, <a href=\"http:\/\/technorati.com\/tags\/visual+basic\" rel=\"tag\">visual basic<\/a><\/div>\n","protected":false},"excerpt":{"rendered":"<p>Another in my recent series on getting Silverlight 2.0 beta 2 working. If you create a WCF web service for Silverlight, it\u2019s 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 &hellip; <a href=\"https:\/\/www.itwriting.com\/blog\/666-fixing-silverlight-20-wcf-reference-in-a-vb-application.html\" class=\"more-link\">Continue reading <span class=\"screen-reader-text\">Fixing a Silverlight 2.0 WCF reference in a VB application<\/span> <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[55,77,80,96],"tags":[],"class_list":["post-666","post","type-post","status-publish","format-standard","hentry","category-microsoft","category-silverlight","category-software-development","category-web-authoring"],"_links":{"self":[{"href":"https:\/\/www.itwriting.com\/blog\/wp-json\/wp\/v2\/posts\/666","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.itwriting.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.itwriting.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.itwriting.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.itwriting.com\/blog\/wp-json\/wp\/v2\/comments?post=666"}],"version-history":[{"count":0,"href":"https:\/\/www.itwriting.com\/blog\/wp-json\/wp\/v2\/posts\/666\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.itwriting.com\/blog\/wp-json\/wp\/v2\/media?parent=666"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.itwriting.com\/blog\/wp-json\/wp\/v2\/categories?post=666"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.itwriting.com\/blog\/wp-json\/wp\/v2\/tags?post=666"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}