Rob Kraft's Software Development Blog

Software Development Insights

Posts Tagged ‘Silverlight’

IIS 5.1 on Windows XP does not a good Silverlight test server make

Posted by robkraft on November 4, 2010

Today we resolved a few problems in our Silverlight application that manifested as [Async_ExceptionOccurred] and “Remote server not found” errors.  Our testing server was running IIS 5.1 on Windows XP.  IIS on Windows XP is limited to just 10 connections.  Since IE8 may be using up to 6 connections at a time, and during testing we often have multiple users, the maximum number of connections is exceeded and errors occur.  We found HTTP response code 403 ( in the logfiles of the IIS server.  I guess that we specifically were getting 403.9 “Too many users”, but that detail is not included in our log file.  Using Fiddler we saw some of the errors as 504 (the very same requests that IIS logged as 403).  The 504 did not seem accurate though because the failure response occurred immediately and our WCF timeouts are all set to 10 minutes.

 I thought I’d post what we found hoping it hastens others experiencing similar problems to a resolution.

Posted in Silverlight | Tagged: | Leave a Comment »

Reading from the registry with Silverlight.

Posted by robkraft on May 20, 2010

Yes, you can read from the registry of the local machine using a Silverlight application.  This is subject to these qualifications:

1)     The Silverlight App must be running out-of-browser.  This is necessary so that you can run the Silverlight App with elevated permissions.

2)     The Silverlight App must be running with Elevated Permissions.  This is necessary so that you can access the COM Interop.

3)     The COM Interop Automation Factory must be available.  Honestly, if you are running out of browser with elevated permission I don’t know why it would not be available.

4)     You must be running Silverlight 4.

To do this for yourself:

1)     Create a new Silverlight Application in Visual Studio 2010

2)     Open the Project Properties, select the Silverlight tab, and check the box for “Enable running application out of the browser”.

3)     Click on the “Out-of-Browser Settings” button and check the box for “Require elevated trust when running outside the browser”.

4)     Place a simple button in the Grid your MainPage.xaml.  Use the default name button1.

5)     Paste this code:

          private void button1_Click(object sender, RoutedEventArgs e)


              if (App.Current.IsRunningOutOfBrowser)

                   MessageBox.Show(“Running Out of Browser!”);

              if (App.Current.HasElevatedPermissions)

                   MessageBox.Show(“Has elevated Perms!”);

              if (AutomationFactory.IsAvailable)

                   MessageBox.Show(“Automation Factory is Available!”);

              dynamic WshShell = AutomationFactory.CreateObject(“WScript.Shell”);



6)     Run the app, right-click on the form and choose “Install ..appname… onto this computer…”

7)     Click the button on the “out-of-browser” version of the app.  Hopefully you receive all the expected values.

Posted in Visual Studio 2010 | Tagged: , | Leave a Comment »

A way to eliminate the foreign language Dlls in Silverlight

Posted by robkraft on April 27, 2010

If you compile silverlight projects you may notice that you get 8 non-english language versions of your DLL. Although this causes no major harm, I personally prefer not to create them because it takes time, it clutters up the results of my nant build output, and I don’t need them. To eliminate the the eight foreign language DLLs from your build process, go to your silverlight libraries folder which is probably C:\Program Files\Microsoft SDKs\Silverlight\v3.0\Libraries\Client, and delete the eight subfolders (de, es, fr, it, ja, ko, zh-Hans, and zh-Hant). With the Visual Studio 2010 install, it looks like you also need to delete the same subfolders from C:\Program Files\Reference Assemblies\Microsoft\Framework\Silverlight\v3.0.

Posted in Visual Studio 2010 | Tagged: | Leave a Comment »

Eliminating some of the foreign language resource files

Posted by robkraft on February 8, 2010

I’m all in favor of the use of resource files for strings and other elements of our programs, but I don’t like seeing all the subfolders for various foreign language resource builds in projects where I will never need them.
Our Silverlight projects were creating 8 foreign language subfolders (de, es, fr, it, ja, ko, zh-Hans, and zh-Hant). Not only does this clutter my hard drive, complicate my version control, and annoy me; but it requires a little longer to compile, and it nearly doubles the size of my nant output log. I know that it doubles the size because when I caused it to stop, the log file size was cut in half.
I managed to stop the creation of all the foreign language resource versions of the files by deleting the foreign language subfolders with those names from C:\Program Files\Microsoft SDKs\Silverlight\v3.0\Libraries\Client.

Posted in Visual Studio 2008 | Tagged: , , | Leave a Comment »

When CopyLocal=True means CopyLocal=False

Posted by robkraft on February 8, 2010

We have learned that CopyLocal = true is misleading. CopyLocal is set to true by default, but that does not always cause the DLL to get included in the .xap. However, if you change it to false, then back to true, it does get included in the .xap. We have experienced this many times in VS2008 with Silverlight 3.

Also, after you do this, you will notice that it does cause a change in the .csproj file. It sets the Private Tag explicitly to true, rather than relying on the msbuild default value of true.
I hope this post helps others resolve this xap file problem more quickly.

Posted in Visual Studio 2008, Visual Studio 2010 | Tagged: , | Leave a Comment »