• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 514
  • Last Modified:

Error on accessing a Silverlight 4 Application Published to a Webserver

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
mydomainname.co.uk/httpd
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" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
    <title>TestApplication</title>
    <style type="text/css">
    html, body {
          height: 100%;
          overflow: auto;
    }
    body {
          padding: 0;
          margin: 0;
    }
    #silverlightControlHost {
          height: 100%;
          text-align:center;
    }
    </style>
    <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") {
              return;
            }

            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);
        }
    </script>
</head>
<body>
    <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="http://go.microsoft.com/fwlink/?LinkID=149156&v=4.0.50826.0" style="text-decoration:none">
                     <img src="http://go.microsoft.com/fwlink/?LinkId=161376" alt="Get Microsoft Silverlight" style="border-style:none"/>
              </a>
          </object><iframe id="_sl_historyFrame" style="visibility:hidden;height:0px;width:0px;border:0px"></iframe></div>
    </form>
</body>
</html>
 Screer Shot of Folder Structure at the Root of My Webserver A Screen Shot of a Subfolder httpdocs on my Webserver
0
FaheemAhmadGul
Asked:
FaheemAhmadGul
  • 2
  • 2
1 Solution
 
vbighamCommented:
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" />
To:
<param name="source" value="ClientBin/TestApplication.zip" />

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.
0
 
FaheemAhmadGulAuthor Commented:
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/TestApplication.zip"
However, I still get the same error.
I would be grateful for some further help.
0
 
vbighamCommented:
"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)
0
 
FaheemAhmadGulAuthor Commented:
Many thanks.
0

Featured Post

Important Lessons on Recovering from Petya

In their most recent webinar, Skyport Systems explores ways to isolate and protect critical databases to keep the core of your company safe from harm.

  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now