Select to view content in your preferred language

Interactive Silverlight SDK 2.0 - KeyNotFoundException error

502
2
08-27-2010 11:00 AM
AngelGonzalez
Frequent Contributor
I have downloaded and installed the 2.0 SDK. When I run the application in VS2010 I get an error in the App.xaml.cs file when trying to read the xml key:

private void Application_Startup(object sender, StartupEventArgs e)
{
string xmlConfig = e.InitParams["xml"];

//this.RootVisual = new Page(xmlConfig);
this.RootVisual = new LightPage(xmlConfig);

System.Windows.Browser.HtmlPage.RegisterScriptableObject("mySLapp", this.RootVisual);
}

The error occurs when trying to read xml key at "e.InitParams["xml"];"

The key is defined with the Default.htm as follows:

div id="silverlightControlHost">
<object data="data:application/x-silverlight-2," type="application/x-silverlight-2"
width="100%" height="99%">
<param name="source" value="ArcGISSilverlightSDK.xap" />
<param name="onerror" value="onSilverlightError" />
<param name="background" value="white" />
<param name="initParams" value="xml=Assets/SDKConfig.xml" />
<param name="onLoad" value="pluginLoaded" />
<param name="minRuntimeVersion" value="4.0.50401.0" />
<param name="autoUpgrade" value="true" />...

I have not changed anything within the code.
When I publish the website as is the code works.

Any thoughts???
0 Kudos
2 Replies
dotMorten_esri
Esri Notable Contributor
Did you set the website to be the startup project? (as opposed to the Silverlight project)
Is your app loading Default.htm ?
0 Kudos
AngelGonzalez
Frequent Contributor
Setting the website to be the startup project worked!

Thanks!
0 Kudos