First Silverlight Application Problem

1081
9
04-13-2010 04:43 PM
EricDaniel
Occasional Contributor III
I'm just trying to run about as simple of an application as possible and I'm getting the following error in IE8 when I go to run:

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

I am able to run non-ArcGIS API apps just fine without error.  I pasted in my code below.  I have the ESRI.ArcGIS.Client reference added to my project.  Any ideas what may be causing my problem here?  Let me know if you need more information.    Thanks

<UserControl x:Class="SilverlightApplication1.Page"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
  
    xmlns:esri="clr-namespace:ESRI.ArcGIS.Client;assembly=ESRI.ArcGIS.Client">
    <Grid x:Name="LayoutRoot" Background="White">
        <esri:Map x:Name="MyMap" >
            <esri:ArcGISTiledMapServiceLayer ID="StreetMapLayer"
           Url="http://server.arcgisonline.com/ArcGIS/rest/services/ESRI_StreetMap_World_2D/MapServer"/>
        </esri:Map>
    </Grid>
</UserControl>
0 Kudos
9 Replies
HubertLo
New Contributor
Are you trying to run the project in design time or runtime?

If you are running in design time, try putting some break points in the code in both App.xaml.cs (or vb) and [mainpage].xaml.cs (or vb). You may get to see the error. If everything works in design time, then you need to get a web debugger (aka sniffer) like Fiddler. It will tell you what is going on between your Silverlight app and the server.

I suspect it has to do with some web server settings. Did you add the MIME types to the web site?
0 Kudos
EricDaniel
Occasional Contributor III
Thanks for the reply.  I'm running in design time.  I have it running on a Windows XP machine, so IIS 5.  I did add the MIME types.  If I can run other non-ESRI API apps fine, wouldn't that mean there isn't a problem with web sever settings?  I tried adding breakpoints but it really doesn't find anything.  I"m really at a lost.  It's a very basic example.  Its the example from the ESRI resources site on getting started and writing your Silverlight app.  Would it help to send the code from the .cs files?

Are you trying to run the project in design time or runtime?

If you are running in design time, try putting some break points in the code in both App.xaml.cs (or vb) and [mainpage].xaml.cs (or vb). You may get to see the error. If everything works in design time, then you need to get a web debugger (aka sniffer) like Fiddler. It will tell you what is going on between your Silverlight app and the server.

I suspect it has to do with some web server settings. Did you add the MIME types to the web site?
0 Kudos
HubertLo
New Contributor
Since I cannot see your project, there are few things I like to know:


  • Did you try to run other Silverlight 3.0 applications?

  • Who (or what) created the virtual directory? Is the IIS settings correct? What about ASP.NET version

  • Did you rename certain Silverlight xaml pages? I believe App.xaml must stay in this name. You can change the other xaml but you need to rename them in App.xaml.cs as well.

  • When that exception occured, did it break into anything in the IDE? It doesn't have to be your code, it could be the compiled files.


Have you try to put breakpoints in these App.xaml.cs functions:
public App()
private void Application_Startup

These are the first Silverlight functions to run in any Silverlight apps.
0 Kudos
dotMorten_esri
Esri Notable Contributor
My guess is the .xap file is not in the website folder that the object tag in the html test page is referring to, or the webserver is not returning the correct mime type for .xap files.
0 Kudos
EricDaniel
Occasional Contributor III
You are the man Morten.  Your first guess was the problem.  Sure enough there was no .xap file in the Client Folder.  So I copied it over into there from the bin folder.  Now it works.  Any idea on why the .xap file is not getting moved or created in the Client Folder? 

Thanks again for your help!. 


My guess is the .xap file is not in the website folder that the object tag in the html test page is referring to, or the webserver is not returning the correct mime type for .xap files.
0 Kudos
dotMorten_esri
Esri Notable Contributor
One of the bugs I've seen in VS2010RC is that when you add a new project, its build action is sometimes not set. Go to "Build - Configuration Manager" and make sure there is a checkmark in the "build" column for your project in all the configurations.
0 Kudos
EricDaniel
Occasional Contributor III
I'm actually using VS2008 Express.  I checked out the setting and there was a checkmark in the build column.  Well, at least I know now if it does it again, I know how to fix it.  Thanks again.
0 Kudos
HubertLo
New Contributor
I use VS2008 as well for the Silverlight work, VS2008 Professional Sp1. There is a setting that controls where xap goes. You should not need to copy it manually. You may want to try publishing the hosting ASP.NET project which should include the ClientBin folder.

In the ASP.NET host project that is created with the Silverlight project automatically in VS2008, look at the properties by Right Click -> Properties. The last item on the vertical tab should be "Silverlight Applications". You should see your Silverlight project shown is the list. The "Path in Web" should be set to "ClientBin" which is the default location. If you change this default location in  object tags in the aspx page, you will have to change the settings here as well.
0 Kudos
JoyC
by
New Contributor
I have the same error, however, i've tried all the solutions suggested - MIME, Build-Configuration Manager. Looks like my Silverlight project just doesn't compile. There's no xap file being created.
0 Kudos