Run Silverlight with Apache Server (Under Linux)

Run Silverlight with Apache Server (Under linux)

If the apache server is just serving up the silverlight application without any ASPX pages then you should be fine. Silverlight is a client side technology so it shouldn't require .NET on the server (unless of course you are hosting the silverlight application on an ASPX page).

If you want to view the silverlight content from a client machine running linux then you will need to look into installing Moonlight as Sam pointed out.

EDIT: Tim Sneath has a blog post that explains what needs to be configured on the web server to be able to host silverlight content. In short you need configure the following MIME types:

.xaml - application/xaml+xml

.xap - application/x-silverlight-app

host silverlight application on normal apache web server?

Silverlight can be hosted from apache just fine. The only thing you need to worry about is that you have the proper MIME types set up. You must have at least .xap files set up to serve a content type of application/x-silverlight-app. If your silverlight app is dynamically grabbing files from your server, you might need e.g. .xaml files to be served as application/xaml+xml.

To set MIME types with apache, you can either use the AddType directive in a .htaccess file, or edit apache's mime.types file directly.

Stream Audio from Linux Server with Silverlight

If you don't care about adaptive streaming, this is really easy - just share the audio out over HTTP, then add a MediaElement (or something like http://smf.codeplex.com if you want it to be fancy, see my caveat at http://blog.paulbetts.org/index.php/2009/11/22/patching-silverlight-media-framework-to-work-with-mp4wmv-files/) and point it towards your Linux server running Lighttpd or Apache.

The critical bit though, is that Silverlight will only be allowed to access the hosting site by default, so you'll need to create a clientaccesspolicy.xml file ( http://www.silverlighthack.com/post/2008/11/08/Silverlight-clientaccesspolicyxml-files-for-the-Enterprise-(Part-1-of-2).aspx ) to allow SL access to your Linux server

Silverlight - Run Method at Application start on server side

You can add to the Startup event in your Application class, e.g.

public partial class App : Application
{

private void Application_Startup(object sender, StartupEventArgs e)
{
... startup code here
}
}

See MSDN. Note that this runs on the client side - not the server side. Code in your silverlight application does not run on the server.

If your code has to run on the server, host your silverlight control in an aspx page and override the page's Page_Load event to execute code BEFORFE the silverlight client is sent to the browser.

What are the server requirements for Silverlight 2?

Since Silverlight is a browser technology, it is server-agnostic and can be hosted on a variety of server platforms: LAMP, UNIX, and IIS. You don't have to install .NET or any other Microsoft software on the server.

The only configuration required on the web server is to register the MIME types for content being served. If not already registered, you'll have to add following entries.

There are three MIME types required:

  • .xaml - application/xaml+xml
  • .xap - application/x-silverlight-app
  • .xbap - application/x-ms-xbap

Here are some instructions how to do that for Apache and IIS.

Needless to say, some features such as WMS Streaming rely on a server supporting them.

Silverlight Deployment

I wrote a fairly long answer to similar problem in Silverlight publish question.

Quick summary:

  1. Server doesn't need anything special - it just sends the XAP file to the browser. Unix servers have no problem hosting Silverlight apps.
  2. Do you see the 'blue loading swirl' or just a blank white area? If no loading indicator, your XAP file probably isn't downloading.
  3. Can you download the XAP file directly or do you get a 404 (eg. type http://yourserver.com/ClientBin/YourSLApp.xap and see if you get a download prompt or not). If you get a 404 then your server is blocking the download. Try renaming your .XAP to .ZIP (and updating your HTML OBJECT tag)
  4. If your Silverlight app loads correctly but it isn't displaying some content (eg images or movies) then once again check you can download them directly from the browser, and verify the URL you've put in your Silverlight app are correct, ESPECIALLY if they are relative paths.


Related Topics



Leave a reply



Submit