If you are working with Sliverlight application (VS2008 and Silverlight on WindowsXP) and getting the error# 2104 as shown in the figure below, then here are some of the trick which will work for you to resolve the issue:

Before trying any major changes in IIS(inetmgr), go to the solution explorer and open ClientBin folder, in which you will see a file created having name of your application and suffixed with a .xap extension, eg- SilverlightApplication.xap.

Now go to your aspx page which is calling the Page.xaml, in most of the cases if unchanged it will be SilverlightAppliacationTestPage.aspx, open this page (Source view) and you will find that source element is set to:

If you observe here the file referred is filename.page which is a default setting, whereas the ClientBin folder have filename.xap, so change the extension of file for source element to .xap

It may help you to get rid of the error. If not…

Lets try some IIS setting changes:

1. Content Expiration Setting

By defalut its not enabled, so enable this:

Step-1: Right-click your Web Site, select Properties from the context menu.
Step-2:Go to HTTP Headers tab and click “Enable Content Expiration”.
Step-3:Set the content to expire after 1 minute.

2. Let IIS know about MIME Types and File Extensions

To enable a Silverlight application under your IIS, you need to register some MIME types and file extensions so that the browser on the client’s system can load the correct handler.

Step-1: Right-click your Web Site, select Properties from the context menu.
Step-2:Go to HTTP Headers tab and click on “File Types” under Mime Map section.

You need to add the following types:
Extension —– MIME Type
.xap ———– application/octet-stream
.xaml ———- application/xaml+xml

3. Change Execute permissions to Scripts Only.

Step-1: Right-click your Web Site and select Properties from the context menu.
Step-2:Select the Directory tab and change “Execute Permissions” to Script only.

Once these settings are done, retry running your app, it will work for you.

If you have installed Microsoft Silverlight Tools Beta 2 for Visual Studio 2008, then you might be facing probelm while designer page is loading and it might be throwing an exception as well.

The resolution to this is to un-install the Silverlight Tools Beta-2, and install the newly released 10/20/2008 Add-on for Visual Studio 2008 SP1 for developing Silverlight 2 application.

Silverlight Tools for VS 2008

Once this update is done, you will be able to find clean designer slate, and there will be no exception/errors/warnings while Silverlight page is loading in the IDE.

If you have tried to install SP1 for Visual Studio 2008 and have experienced failure then follow the steps as mentioned below:

These steps applies to if you have Visual Studio 2008 alone, or on the top of some Beta components of SQL Server and Visual Studio 2008.

Tricks before you begin installation:
1- Disable Automatic updates.
2- Disable any of the Anti-virus, spyware etc.
3- Set Windows Firewall to Off.
4- Keep the VS 2008 Installation media ready.

Step -1: Visual Studio 2008 Service Pack Preparation Tool

Step -2: Microsoft Visual Studio 2008 Service Pack 1

In this step-2, you may experience that at the end of installation wizard “SQL Publishing Wizard 1.3” is running forever, if you face the same then cancel the setup, and it will show you the finish dialog. Now you can successfully perform Step-3.

Step -3: Microsoft Silverlight Tools Beta 2 for Visual Studio 2008

Once these steps are performed then you can go to Visual Studio –> Help menu –> About Visual Studio, and you will see that SP1 is installed along with SilverLight as show in the figure below. Also it will install all the updates during the installaion procedure.