Sunday, February 6, 2011

Silverlight and the dreaded 2104 error

So I am working on my latest side project (learning Silverlight 4) and the samples from the book I am reading Microsoft Silverlight 4 Data and Services Cookbook are causing errors, not all of them, just most of them.  Here are the problems I encountered and how I resolved them.

First error was the One or more projects in the solution could not be loaded error. This was a pretty simple fix, right click on the project and select edit and then change the v3.0 to v4.0.  Next just click save, close the file and right click on the project, selecting Reload Project. 

Problem solved, the project loads, time for a coke and a smile?  Not always.  The next error I ran across was a freaky Webpage Error, Line 56, Error: Unhandled Error in Silverlight Application Code: 2104. 

This error had me stumped for awhile, with many solutions saying to add the .xap extension mime type under IIS6 or IIS7. Only problem, I am on a development machine and not using IIS, so what do I do.

Open your project properties, click on the Silverlight tab, and click Add.. Select the Silverlight 4 application that is being built, leave the destination the default ClientBin and click Add. 

The problem that took me many hours to resolve fixed in less than a minute of your time.

As for the book I am still working on it but with the samples working it is very detailed and covers both WCF webservices as well as WCF RIA web services.  Give it a look if you are working on Silverlight 4 like me!

No comments:

Post a Comment