Silverlight 2101 - Initialization Error

We build our Silverlight application and deploy it to multiple clients, each of whom may require different currency or date formats depending on where in the world they may be located.

This troubled us for a while until we hit upon our current solution of adding an ApplicationSetting to our web.config that is transformed to the required value by Web Deploy.

The transformed value is then parsed by the ASP .Net controller action and passed into the Silverlight as a parameter from the Razor View's ViewBag, like this:

<object data="data:application/x-silverlight-2," type="application/x-silverlight-2">

  <param name="source" value="ClientBin/Application.xap" />

  <param name="onError" value="onSilverlightError" />

  <param name="minRuntimeVersion" value="5.1.10411.0" />

  <param name="uiculture" value="@ViewBag.ApplicationCulture" />

  <param name="culture" value="@ViewBag.ApplicationCulture" />

  <param name="autoUpgrade" value="

  <param name="initParams" value="Version = @ViewBag.Version"/>


This has worked fine for us for many months now, until yesterday when we came to deploy the application to a new server, which worked successfully. However, on trying to load the Silverlight Application we encountered the 2101 Initialization Error and/or a blank web page.

A quick Google lead to suggestions of the application not being compiled under the AnyCPU setting and this did distract me for a while whilst I hunted for a non-existant missing AnyCPU build configuration in the ~150 projects which make up our solution.

Having not found anything I continued to narrow down where the error was occurring until I arrived at the Application Settings being passed into Silverlight as initParams values. There I found the culprit of this error.

The application culture set in the web.config file during Web Deploy, was set to an invalid Culture Code of en-DE. This then triggered the Initialization Error.

So, if you've got a Silverlight 2101 error, check the Culture Code you're passing into the application is a valid code from Microsoft. Hopefully this saves somebody else the hours of my life I lost yesterday hunting this error down due to the lack of information provided by the obscure error message.