Date Published: September 2007.
Author: Claudio Vacalebre.
Soundtrack: Who's Crazy?, Author: Claudio Vacalebre.
Question: which is the main difference between a Hoster declaring Silverlight Compatibility and one who is not declaring Silverlight Compatibility?...
Multiple answers for a simple question... You could say: "The first should have done some testing, the second shouldn't." This could be a fair answer.
Or you could say: "The hoster don't care about it as it is a client-side matter", well, this is also a fair answer, indeed Silverlight is not platform dependent, but you'll see later there could be few cases were the hoster needs to adjust the web server configuration, so the hoster has to do something..., at least some testing...
In most of the cases, if you upload your perfect "Hello World" Silverlight application on the the first (that one declaring Silverlight compatibility), then it just works as expected.
But what could happen [to you] if your hoster has not declared anything around it?... At least you could find yourself (in the worst case) spending some time debugging your application to find the solution .
You indeed learnt that Microsoft® Silverlight™ is a cross-browser, cross-platform plug-in for delivering the next generation of .NET based media experiences and rich interactive applications for the Web, so you do not understand why your Silverlight Application shouldn't work.
Anyway, here the scenario. I have developed a muted metronome (don't ask me why a muted metronome, this is just my first Silverlight project so please don't complain!... :-)) and it works perfectly using the Visual Studio 2005 debugger.
Now, the next step is to upload it on My [Smart Hosting] site which is hosted by an Hoster who declares Silverlight Compatibility. FTPing the Silverlight Application on my site is so easy that the upload takes just few seconds (ok, ok, I should use more sofisticated tools such as the Publish feature in Visual Studio, I know... shame on me!...:-).
Then, running the new Silverlight Application is just easy as accessing a web page and it's Done! See next pane for a live demonstration...:-) and consider this has been done embedding the Silverlight Application in a Ajax Control!
Before moving to next pane be sure to Download and Install Silverlight!.
So until now everything seems OK. Application developed, deployed and Up and Running. Life seems so easy!...
Now, I have a second Smart Hosting web site; its hoster is not declaring any Silverlight Compatibility therefore I'm so curious to understand if is there any real difference between the two.
So, without waiting more I have uploaded the same Silverlight application on the second Smart Hosting web site to see if it works as expected. But it didn't, an empty page is displayed.
.
As you have seen (clicking in the last link on the previous pane) the output is extremely different (with the exception of the page title).
That page is embarassely blank. So, it seems there is a BIG difference!
While trobleshooting it I have found an interesting article at the Silverlight Forums called Server isn't seeing my xaml file.
As part of the suggestion to solve the issue Server isn't seeing my xaml file VladF replied with "I had this problem before. It is probably because MIME type for XAML is not registered on your server. Until you get it registered you can change the file extension from .xaml to .xml and this should work.".
So what I did was to try to change the declaration within the Silverlight Javascript helper file; specifically the CreateSilverlight() function simply changing the extension from .xaml to .xml and copying the .xaml file in a new file with .xml extension...
function createSilverlight()
{
var scene = new SilverlightJSApplication1.Scene();
Silverlight.createObjectEx({
source: 'Metronome.xml', // This has been changed, from xaml to xml
parentElement: document.getElementById('SilverlightPlugInHost'),
id: 'SilverlightPlugIn',
properties: {
width: '300',
height: '370',
background:'#ffffffff',
isWindowless: 'false',
version: '0.8'
},
events: {
onError: null,
onLoad: Silverlight.createDelegate(scene, scene.handleLoad)
},
context: null
});
}
Now, with the change done it works perfectly.
As you have seen, the workaround has been trivial but this could case some problem while developing your application as you need to manually customize it...
Two days ago I have attended a 101 Silverlight presentation on Second Life at Microsoft Visual Studio Island (Snapshot).
To be teleported to Visual Studio Island click here!.
This has been my first participation to a Second Life "event"; during the presentation I have found myself smiling while watching "people" around me or someone dancing while the presenter was speaking.
I took a snapshot at the end of the event just to let you understand what I'm writing here (look at Adam, Valio and Zion!...I'm that one with no hair)
These are us!
As you have seen, choosing a Hoster who is declaring Silverlight Compatible could help making your life easier
Actually there are not a lot of them declaring Silverlight Compatibility even because there is no such real need; Silverlight doesn't depend on the web server platform; it could be any web server capable to accept HTTP GET.
Anyway, if your looking to enjoy this world using Silverlight, be sure to subscribe web hosted services only with Smart Hosters (like mine)!
The second thought here is that the Silverlight forums has been of great inspiration to catch and solve the issue; I was so lucky to solve it at first try!... Beginner's luck!.. :-)