Having clients over the globe, we encountered some serious loading delays for initially retrieving the XAP from various locations. The hope was that we could host the compiled XAP in the cloud, offering a closer download depending on the end-user's location.
We are using RIA services, but the service endpoints need to remain on our local server, because of data connections, connections to internal services, etc.
How do we distribute the XAP using cloud-based services, while having it continue to function the same as it does currently?
EDIT: Since I worked through this and found the answer myself, I've moved the steps that I had accomplished before out of my question and into the answer to better facilitate a good Q&A format and for anyone else approaching the problem from step zero.
After hammering away at this, I found the solution to get it almost completely working.
Content-Type
ofapplication/x-silverlight-app
. I accomplished this using Azure Storage Explorer. You can setContent-Type
by opening the properties of the item via double-click, but, and even better, you can click the Settings gear to 'Edit Content Types' and add a rule that.xap
isapplication/x-silverlight-app
so that it will be automatically set any time you upload.source
. Additionally, you will need to add theenablehtmlaccess
param if not already set, since this value is false by default for cross domain.For item #1, I accomplished using code such as the following:
For item #4, my code looked like:
One last thing to note: If using a custom splash screen, then figure out how to get this to work. I don't know how. What I have found out is that if you set
splashscreensource
as the location of a.xaml
file, then it simply does not load. It will just show the basic silverlight load percent screen, which does at least seem to report load % correctly. In order to get the custom splash screen to load, it seems to only work when included inline. You can do this via:However, while this will show the custom splash screen, it will not work if you have any progress report on the splash screen. The javascript function referenced by
onsourcedownloadprogresschanged
will never fire. I could not find why this was the case, nor a way around it. You'll just have to have a spinning animation or the like in place of an actual % progress indicator.