After I had tested (or thought I'd tested) and uploaded the
Searcharoo version 7 CodeProject article, I deployed 'example code' to
searcharoo.net, including the
Silverlight UI. I was shocked and annoyed when it failed to run!
It's worth noting that my hosting provider doesn't server
.XAP files by default, so of course I had just renamed the
Silverlightaroo.XAP
to
Silverlightaroo.ZIP
, updated the reference in the HTML and expected it would work (like
Tim says it should).
BUT all I got was
Microsoft JScript runtime error: Unhandled Error in Silverlight 2 Application This operation is not supported for a relative URI. at System.Uri.get_Host()
I was confused why this would work fine with
.XAP but not with
.ZIP... these are the three scenarios I tried to get it working:
1. <param name="source" value="Silverlightaroo.xap" />This works fine on my local PC, but
breaks on my hosting provider because the XAP file returns a 404 so the Silverlight application never loads.
When it works locally, you can see that the
Application.Current.Host.Source
properties are all populated correctly:
2. <param name="source" value="Silverlightaroo.zip" />Because option #1 doesn't work on my server, I simply renamed .XAP→.ZIP and updated the HTML - but this causes the error shown above. When I debug the Silverlight, the
Application.Current.Host.Source
properties all throw exceptions:
3. <param name="source" value="http://localhost:3359/Silverlightaroo.zip" />The solution was to use the FULL path to the Silverlight
.ZIP file, and once again the
Application.Current.Host.Source
properties are populated:
This is not ideal, because now I have to remember to
change the HTML OBJECT tag "source" PARAM between development/test and production servers - but at least it works! You can
see the page in action.
Is it just me - or is this a bug?