none
Error: Unhandled Error in Silverlight Application Code: 2104

    Question

  • After I install Silverlight 3 Tools for Visual Studio 2008, I started a new Silverlight Application Project.

    When I try to run this default project, I get this error:

    Error: Unhandled Error in Silverlight Application Code: 2104

    Category: InitializeError

    Message: Could not download the Silverlight application. Check web server settings

    What is the problem?

    Wednesday, July 15, 2009 7:27 PM

Answers

  •  Hi,

    The error maybe due to MIME types. You will have to add the following MIME types:

    .xaml    application/xaml+xml
    .xap    application/x-silverlight-app
    .xbap    application/x-ms-xbap

    Thursday, July 16, 2009 3:20 AM
  • The hash character is significant in a URL. It marks the start of a bookmark string. If this gets into the URL it will be incorrectly interpreted, and the browser won't find, well, anything.

    However, I was completely wrong about that.

    The real problem is that you need to add the app to the web's list of apps. In the web project properties, the bottom tab is Silverlight Applications. Select this and you will probably find an empty list. Click the Add... button and it will suggest Use an existing Silverlight project in the solution and you can pick the project from a combobox. There is probably only one and it will be selected so all you need do is click Enable .NET RIA services then leave Destination folder set to ClientBin and click the Add button.

    You should now be able to run successfully because the XAP file will be automatically copied to the ClientBin folder.

    Monday, July 27, 2009 8:11 AM

All replies

  •  Hi,

    The error maybe due to MIME types. You will have to add the following MIME types:

    .xaml    application/xaml+xml
    .xap    application/x-silverlight-app
    .xbap    application/x-ms-xbap

    Thursday, July 16, 2009 3:20 AM
  • The hash character is significant in a URL. It marks the start of a bookmark string. If this gets into the URL it will be incorrectly interpreted, and the browser won't find, well, anything.

    However, I was completely wrong about that.

    The real problem is that you need to add the app to the web's list of apps. In the web project properties, the bottom tab is Silverlight Applications. Select this and you will probably find an empty list. Click the Add... button and it will suggest Use an existing Silverlight project in the solution and you can pick the project from a combobox. There is probably only one and it will be selected so all you need do is click Enable .NET RIA services then leave Destination folder set to ClientBin and click the Add button.

    You should now be able to run successfully because the XAP file will be automatically copied to the ClientBin folder.

    Monday, July 27, 2009 8:11 AM
  • I have a simple Silverlight 3 project that I am trying to run on a Win 2003 Server system with IIS 6. I have checked my Mime types about 14,000 times and I still get this error. It has to be something to do with how IIS is set up, since if I run using the VS 2008 development server my project runs fine. I have checked that the .xap file exists in the ClientBin folder, and I have tried to migrate to it using IE but I get a "File not found" error (IE finds the ClientBin folder just fine). Any ideas? Thanks Helen
    Friday, September 11, 2009 5:32 PM
  • Can you access any other file in the ClientBin folder using the browser?

    Friday, September 11, 2009 5:51 PM
  • Yes, I put a text file into the ClientBin folder and browsed it both using IE and IIS.

    Thanks for your reply -- sorry I took so long to answer but it seems like my e-mail alert for this thread is not working.

    Helen

    Wednesday, September 16, 2009 6:44 PM
  • I finally found the solution to this problem.

    It seems like the MIME types for .xap and .xaml may need to be added to the individual website, not just the root. When I did this the problem went away.

    It still leaves me with a problem on my hosted environment -- I guess I will have to get my web host support guys to add the MIME types to my website.

    Cheers,

    Helen

    Monday, October 26, 2009 10:05 AM
  • This seems to occur at the release of a new version of SL. It hapened when I installed SL 5. When I created a new SL Bus Project, it should target SL 5 but the it is set to target SL 4 in the project propertires. My solution was to change the target SL to 5 and it prompts to rebuild. Say yes, it then it will work fine. From there you can roll back the target SL to 4 and then it will work fine.

    Saturday, March 10, 2012 1:51 PM
  • I know this thread is old but I have just experienced this error with a Silverlight 5 project and VS 2012 Update 4. Changing the target project of the Silverlight project to Silverlight 4 then back to 5 worked for me also. 
    Thursday, December 05, 2013 11:48 AM