rotary_engine
rotary_engine

Reputation: 569

VS2010 Code: 2104 Could not download the Silverlight application

I've just started getting this Javascript error running VS2010 with SL4

Error: Unhandled Error in Silverlight Application 
Code: 2104    
Category: InitializeError       
Message: Could not download the Silverlight application. Check web server settings     

Everything was working fine, changed 1 line of code to use a RegularExpression in the web project (using the Silverlight Business Application template) then when rebuilding I get this error.

Google says this is IIS and mimetype related. I'm using Cassini not IIS with VS2010.

Rebooted, cleared xap from IE cache. Error on both IE and FF.

What could be wrong?

Upvotes: 13

Views: 23761

Answers (11)

D S
D S

Reputation: 251

Follow the Step :

On Hosting project, Properties > Silverlight Applications > Add..

This solved my Problem. Simple error.

Upvotes: 3

Peter Morris
Peter Morris

Reputation: 23224

The problem in my case was that http://mysite/ClientBin/MyApp.xap was returning a 404. The build process was copying the XAP file into /ClientBin/DEBUG/ - I expect this is because someone told it to copy the XAP file to a config specific folder. To fix it I did the following...

  1. Go to the properties of your website.
  2. Go to the Silverlight Apps page.
  3. If your Silverlight app is already referenced there, remove it.
  4. Now click Add.
  5. Select your existing SL app.
  6. Make sure "Copy to a config specific folder" is NOT checked!

Upvotes: 1

Mike
Mike

Reputation: 799

For my case (with visual studio 2012), one of the projects in the solution wasn't loaded...

right click->reload project.

fixed.

Upvotes: 0

Amirhosein Karimi
Amirhosein Karimi

Reputation: 59

for my case it occured In IE and in chrom the project work. it resolved by disable protected mode in IE.(Internet Option -->Security)

Upvotes: 0

Dan
Dan

Reputation: 2858

.xap file was not getting copied to ClientBin directory

Upvotes: 1

dev.bv
dev.bv

Reputation: 980

I faced a similar issue and it was solved with the help of this blog post: http://vanderbiest.org/blog/2009/10/27/2104-silverlight-initialization-error/

Just ensuring that IIS_IUSRS has read and read & execute permission on the XAP file might fix this issue.

Upvotes: 1

Eranga Dissanayaka
Eranga Dissanayaka

Reputation: 1930

I also had the same issue on VS 2010. And the reason was that the .xap file was not getting copied to ClientBin directory of the hosting web site project.

Reason was the association from the hosting web site project to the silverlight project was missing for some reason. (should be due to some restructuring of the projects that I've done recently in my case) I had to re-add the association from the hosting web site project to the silverlight project.

Steps: On Hosting project, Properties > Silverlight Applications > Add..

Upvotes: 1

okieh
okieh

Reputation: 627

I had the same error with my provider. When I looked at the MIME type everything seemed to be OK:

.xap => application/x-silverlight-app

which seems to be the default value on IIS 6. Then I looked at the webpage VS 2010 created and noticed that it has a MIME type of

application/x-silverlight-2

I changed the MIME type on IIS according to the webpage's type and - my silverlight application gets loaded without any error!

Upvotes: 2

CedricB
CedricB

Reputation: 1167

if youre not running in IIS then just check your silverlightControlHost div in your test page and make sure you are pointing to the correct .xap file and runtime.

If you were in MVC you could do something similar...

<param name="source" value="@Url.Content("~/ClientBin/NameOfYourSlAppGoesHere.xap")" />

Upvotes: 3

Rachel Martin
Rachel Martin

Reputation: 537

This error often occurs because the MIME type is not set, as you have found for yourself. It can also be a mask for the HTTP error. You can see the message by pulling up the XAP file directly from your browser (http://yourwebsite/ClientBin/filename.xap). The file will either attempt to download, or it will show you an HTTP Error.

Upvotes: 1

Keith Elder
Keith Elder

Reputation: 1809

I just got this error myself. Looking at source control and my project I noticed that the original test pages that were created when I setup the project got replaced by two new test pages (one .aspx and one .html).

I removed the newly created pages and went back to the old test pages and things started working.

If your situation isn't the same as mine, then just check your silverlightControlHost div in your test page and make sure you are pointing to the correct .xap file and runtime.

Upvotes: 8

Related Questions