Error on accessing a Silverlight 4 Application Published to a Webserver

Posted on 2011-05-11
Last Modified: 2013-11-12
I have a Simple Silverlight 4 application that I am trying to publish to a webserver. I am able to publish the application to my webserver from wihtin Visual Studio 2010 using FTP (using Visual Studio’s one click deployment option).
However when I try to access the application the application does run and instead I see the following in the internet explorer. I would appreciate help with sorting this problem.

Please note I am publishing my application to folder on my webserver named
I include a screen shot of how my webservers folders looks like after I publish my application to it. My Webserver support staff advised me to publish my website to httpdocs (a subfolder on the root of my domain on my webserver). The zap file for the application is in the ClientBin.

The following is what I see on my visiting my website through internet explorer.

<%@ Page Language="VB" AutoEventWireup="true" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "">
<html xmlns="" >
<head runat="server">
    <style type="text/css">
    html, body {
          height: 100%;
          overflow: auto;
    body {
          padding: 0;
          margin: 0;
    #silverlightControlHost {
          height: 100%;
    <script type="text/javascript" src="Silverlight.js"></script>
    <script type="text/javascript">
        function onSilverlightError(sender, args) {
            var appSource = "";
            if (sender != null && sender != 0) {
              appSource = sender.getHost().Source;
            var errorType = args.ErrorType;
            var iErrorCode = args.ErrorCode;

            if (errorType == "ImageError" || errorType == "MediaError") {

            var errMsg = "Unhandled Error in Silverlight Application " +  appSource + "\n" ;

            errMsg += "Code: "+ iErrorCode + "    \n";
            errMsg += "Category: " + errorType + "       \n";
            errMsg += "Message: " + args.ErrorMessage + "     \n";

            if (errorType == "ParserError") {
                errMsg += "File: " + args.xamlFile + "     \n";
                errMsg += "Line: " + args.lineNumber + "     \n";
                errMsg += "Position: " + args.charPosition + "     \n";
            else if (errorType == "RuntimeError") {          
                if (args.lineNumber != 0) {
                    errMsg += "Line: " + args.lineNumber + "     \n";
                    errMsg += "Position: " +  args.charPosition + "     \n";
                errMsg += "MethodName: " + args.methodName + "     \n";

            throw new Error(errMsg);
    <form id="form1" runat="server" style="height:100%">
    <div id="silverlightControlHost">
        <object data="data:application/x-silverlight-2," type="application/x-silverlight-2" width="100%" height="100%">
              <param name="source" value="ClientBin/TestApplication.xap"/>
              <param name="onError" value="onSilverlightError" />
              <param name="background" value="white" />
              <param name="minRuntimeVersion" value="4.0.50826.0" />
              <param name="autoUpgrade" value="true" />
              <a href="" style="text-decoration:none">
                     <img src="" alt="Get Microsoft Silverlight" style="border-style:none"/>
          </object><iframe id="_sl_historyFrame" style="visibility:hidden;height:0px;width:0px;border:0px"></iframe></div>
 Screer Shot of Folder Structure at the Root of My Webserver A Screen Shot of a Subfolder httpdocs on my Webserver
Question by:FaheemAhmadGul
    LVL 7

    Expert Comment

    This is a linux server yes?

    If you want the .xap file to work as is, you will have to be sure that your web server has the required mime type to serve .xap files.  Also, you will not be able to run .aspx pages without mod mono or something like that.  I recommend using a plain html page with the object tag for silverlight, and add the .xap Mime type to your web server application (apache?).  

    I have also served silverlight content from linux by simply changing the file extension of the .xap file to .zip, you would have to also change the reference inside the html page, but likely your web server is already set up to serve .zip files and it should not make a difference for the silverlight plugin.

    Just to be clear.  Change:
    <param name="source" value="ClientBin/TestApplication.xap" />
    <param name="source" value="ClientBin/" />

    and rename the .xap file to match..

    I can only assume it is linux since the screen shot sort of looks that way, sorry if I am wrong and this doesn't apply.  If you don't have access to the web server application's config, then renaming the .xap to .zip may be the only way to make this work.

    Author Comment

    Thank you for your response to my request for help. Your guess is right this is a Linux Server. The web hosting company is 1 &1.
    I am novice in terms of web administration. I have access to my Server through a Control Panel, but their technical support and help files do not seem good. I do not know how to check if the server I am using has the required MIME type to serve xap file. I have spoken to the technical support on a phone quite a few times, but they are not very helpful, they say they do not provide web administration support. If possible please let me know which part of the control panel I should go to find out if my server has the required MIME type to server xap files.
     I have not been able to understand the part of your comment where you say  
    "you will not be able to run .aspx pages without mod mono or something like that."

    I have tried you suggestion of changing the name of the xap file to zip and of changing to
    param name="source" value="ClientBin/"
    However, I still get the same error.
    I would be grateful for some further help.
    LVL 7

    Accepted Solution

    "you will not be able to run .aspx pages without mod mono or something like that."

    What I am saying is that linux is not equipped to run .aspx pages.  There are extensions that can be installed to do this, but it seems likely given the situation that you will not be able to add those.  And in any case, it can be quite complicated especially if you are not well accustomed to linux.

    I think it should work for you to use the TestApplicationTestPage.html instead of TestApplicationTestPage.aspx (based on the screen shot)

    Author Closing Comment

    Many thanks.

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    6 Surprising Benefits of Threat Intelligence

    All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

    Introduction HyperText Transfer Protocol ( or "HTTP" is the underpinning of internet communication.  As a teacher of web development I have heard many questions, mostly from my younger students who have come to t…
    Foolproof security solutions has become one of the key necessities of every e-commerce or Internet banking website. If you too own an online shopping site then its vital for you to equip your web portal with customer security features that can allow…
    This video teaches viewers how to create their own website using cPanel and Wordpress. Tutorial walks users through how to set up their own domain name from tools like Domain Registrar, Hosting Account, and Wordpress. More specifically, the order in… provides powerful tools for surveying targeted groups, and utilizing data from completed surveys to find trends, discover areas of demand or customer expectation, and make business decisions on products or services.

    737 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    18 Experts available now in Live!

    Get 1:1 Help Now