Powered by MSDN

US - English
NEW! Silverlight 5 is available Learn More

Trying to run Silverlight App from public Azure Blob St... RSS

8 replies

Last post Mar 11, 2011 06:49 PM by gigyjoseph

(1)
  • carlosp_uk

    carlosp_uk

    Member

    42 Points

    20 Posts

    Trying to run Silverlight App from public Azure Blob Storage

    Jan 22, 2009 11:18 AM | LINK

    Hullo there

    I'm hosting my alpha Silverlight game website on Azure (at q.cloudapp.net).  At the moment, I've included the XAP file as part of the web package, but this is problematic because every time I want to rebuild my Silverlight App I have to re-upload the whole package, taking upwards of 15 minutes to upload, stage then deploy.

    For this reason,  I have tried to move my XAP file to within a public access container in Azure Blob Storage. I can confirm that the XAP file is there and publically accessible by URL from a browser.  So, presumably, to access it, the code at q.cloudapp.net/foo.html becomes:

    ...
    <object id=...>
    <param Source="http://cant.remember.url.core.microsoft.net/thegame/TheGame.XAP">  

    Unfortunately, when I do this, the silverlight App loads within the browser, all the way up to 100% and then... absolutely nothing happens.   If EXACTLY the same XAP file is included locally in cloudapp.net, then it works.  I have tried re-starting the browser to avoid any caching issues.

     

    Some important observations:

    - If I replace the XAP with an incredibly simple 'hello world' example, then it does definitely work.  So it must be something about my XAP, I assume.

    - If I examine the http requests using a Fiddler-type plugin for Firefox, I can see that the XAP file is requested, transfers to my browser, but then no further file requests are made or denied.

     

    I'm tearing my hair out!  I thought it might be something to do with the fact that my XAP does, fyi, try to access local files on the webserver.  I have copied all these to blob storage just in case, but to be honest if there are no file requests being made within Fiddler, then surely it can't be this?  As far as I can see, it doesn't actually get to the point of executing the Silverlight App at all.

    Are there any known issues or can anyone give me some pointers on how I might even go about trying to debug this.

    Best wishes,

     

    Carlos

     

    PS: All testing of the new blob-hosted XAP was done using the local developer fabric, and never deployed (as it doesn't work)

    silverlight xap azure blob storage

    ====================================================
    carlosp_uk
    Windows Mobile and Silverlight Application Developer
    www.fatattitude.com
  • Bitnbytes

    Bitnbytes

    Member

    281 Points

    78 Posts

    Re: Trying to run Silverlight App from public Azure Blob Storage

    Jan 22, 2009 01:28 PM | LINK

    Check if this has something do with MIME type not being registered on web server. See the following post that talks about it.

    Silverlight XAP Mime Type Registration
  • carlosp_uk

    carlosp_uk

    Member

    42 Points

    20 Posts

    Re: Re: Trying to run Silverlight App from public Azure Blob Storage

    Jan 22, 2009 01:58 PM | LINK

    No, I'm pretty certain the MIME types are registered fine - if they weren't, the Silverlight plugin wouldn't begin it's 'circle of blobs' loading routine...

     

    ====================================================
    carlosp_uk
    Windows Mobile and Silverlight Application Developer
    www.fatattitude.com
  • Yi-Lun Luo - MSFT

    Yi-Lun Luo -...

    All-Star

    25149 Points

    2759 Posts

    Microsoft

    Re: Re: Re: Trying to run Silverlight App from public Azure Blob Storage

    Jan 27, 2009 08:23 AM | LINK

    Hello, by default, you can't reference an xap file on another domain. But you can modify the settings.

    Please unpack the xap package, open AppManifest.xaml, and add a property:

    ExternalCallersFromCrossDomain="ScriptableOnly"

    Now back to your hosting html page, add the following property to the object tag:

    <param name="enableHtmlAccess" value="true" />

    shanaolanxing - I'll transfer to the Windows Azure team, and will have limited time to participate in the Silverlight forum. Apologize if I don't answer your questions in time.
  • carlosp_uk

    carlosp_uk

    Member

    42 Points

    20 Posts

    Re: Re: Re: Re: Trying to run Silverlight App from public Azure Blob Storage

    Jan 27, 2009 09:59 PM | LINK

    Yi-Lun

    Thank you so much for this!  I searched high and low and was unable to find any relevant articles or pointers, and you have very much helped - it now works, and the evidence can be seen at http://www.squarepeggame.com

    Thanks!

     

    Carl

    ====================================================
    carlosp_uk
    Windows Mobile and Silverlight Application Developer
    www.fatattitude.com
  • carlosp_uk

    carlosp_uk

    Member

    42 Points

    20 Posts

    Re: Re: Re: Re: Trying to run Silverlight App from public Azure Blob Storage

    Jan 27, 2009 10:00 PM | LINK

    EDIT:  By the way, is there any way to get the Silverlight App to access local files in blob storage relative to its own directory?  (without specifying the absolute URL) Or will the App by default use files from the domain of the host web page?  I keep various sound files that are used in the game and it would be helpful if they, too, could be held in the blob rather than as part of the Web Role.

     Answered my own question:

    TO GET A FILE FROM LOCAL Resources inside XAP

    StreamResourceInfo sr = Application.GetResourceStream(new Uri("TheGame;component/Sounds/file.mp3", UriKind.Relative));
    meMusic.SetSource(
    sr.Stream);

     

    TO GET A FILE FROM XAP Resources first, then search XAP domain

    meMusic.Source = new Uri("Sounds/file.mp3", UriKind.Relative);

     

    TO GET A FILE FROM DOMAIN OF HOST WEBPAGE  (requires cross-domain permission)

    newMediaElement.Source = new Uri(System.Windows.Browser.HtmlPage.Document.DocumentUri, FN);

     

    ====================================================
    carlosp_uk
    Windows Mobile and Silverlight Application Developer
    www.fatattitude.com
  • baskarg83

    baskarg83

    Participant

    1257 Points

    323 Posts

    Re: Re: Re: Trying to run Silverlight App from public Azure Blob Storage

    Mar 10, 2010 04:55 PM | LINK

     hi

     

    for me its displaying the blank page,

    <div id="silverlightControlHost">
            <object data="data:application/x-silverlight-2," type="application/x-silverlight-2" width="100%" height="100%">
                <param name="source" value="http://blob.core.windows.net/Sample/Helloworld/ClientBin/HelloWorld.xap"/>
              
                <param name="onerror" value="onSilverlightError" />
                <param name="background" value="white" />
                <param name="enableHtmlAccess" value="true" />
                <param name="minRuntimeVersion" value="3.0.40624.0" />
                <param name="autoUpgrade" value="true" />
                <a href="http://go.microsoft.com/fwlink/?LinkID=141205" style="text-decoration: none;">
                     <img src="http://go.microsoft.com/fwlink/?LinkId=108181" alt="Get Microsoft Silverlight" style="border-style: none"/>
                </a>
            </object>
            <iframe style='visibility:hidden;height:0;width:0;border:0px'></iframe>
        </div>

     

    i have copy the URL from blob storage abd paste it in source.

    in silverlight i have add 

    <Deployment xmlns="http://schemas.microsoft.com/client/2007/deployment"
            xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" ExternalCallersFromCrossDomain="ScriptableOnly"
    >
        <Deployment.Parts>
        </Deployment.Parts>
       
    </Deployment>

     

    After i have run the Webrole project , i have getting the blank page.  

    can you help me out.

     

    Thanks in Advance

     

    if it is useful "Please Mark as Answer"

    With Regards
    G.Baskar
  • beermann

    beermann

    Member

    2 Points

    1 Post

    Re: Re: Re: Trying to run Silverlight App from public Azure Blob Storage

    Apr 07, 2010 12:14 AM | LINK

    This took me forever to figure out. After playing around with everything mentioned here, this was my problem: http://www.thetechnologystudio.co.uk/technologyblog/index.php/2009/06/hosting-silverlight-applications-in-azure-blob-storage/

    I had uploaded the file through my web app when it starts, and the content type was set to application/octet-stream. It needs to be application/x-silverlight-app to load correctly.

    silverlight blob storage content type xap file cross domain

  • gigyjoseph

    gigyjoseph

    Member

    30 Points

    26 Posts

    Re: Re: Re: Trying to run Silverlight App from public Azure Blob Storage

    Mar 11, 2011 06:49 PM | LINK

    I was also struggling similar way , you may needs to two more  items

    1. Use fidler/HttpWatch to see how far the call goes . This will also let you know that whether the .xap file recognized as the Siverlight file

    2. Make sure the appropriate MIME type is added in IIS

    3. Do a iis reset after the changes in step 2

    This may help

    Regards-
    Gigy
    http://www.code.gigyonline.com