Tuesday, March 11, 2008

Silverlight 2: Test 1

I made a small test app using Silverlight 2 beta 1. This is a short and sweet app that will take the test entered in the textbox and put it in the label when a button is pressed. This is just to play with the a couple of the new controls. This was a stupid little test that actually helped out pretty well. The sample ran really well locally so I went to put it up on my web server. This is where things started to get strange.

First when you look at the ClientBin folder there was my testpage.html file as well as a bunch of .dll files and one that I did not recongnize, a .xap file. Since I use Total Commander I used thefile viewing features to see that this new file was just a zip file of the .dll files and the .xaml manifest. I then looked at the test page and it refers to the .xap file when it creates the silverlight object. So I copied over just the test page and the .xap file to my server.

The test app that ran so well for me did not work at all. Nothing loaded, nothing worked. The source showed that the object and everything looked like it should work. To see what I saw you can see it here:

http://ystail.com/silverlight/test1/

I remembered that for Silverlight 1.0 to get it to work you had to set the MIME code on your server. You had to setup xaml to be an application so that it ran correctly. Of course I tried this and it still did not work. But from there I thought that since Silverlight 2 beta 1 automatically zips into a .xap file, that you might need to set .xap as an application.

Extension ".xap"
MIME type "application/xap"

After getting this setup for one of my servers, the app came up and worked just fine.

http://ysgard.com/silverlight/test1/

This seems to work pretty well and will be a good start for future tests with Silverlight 2. There are alot of things that I want to do with this including games, but that is all for another post.

No comments: