none
Cross domain hosting silverlight when the cross domain is localhost doens't work.

    Question

  • I use an user script to inject a silverlight app in some pages. If I host the silverlight app on an external provider the injection works if I host the silvelight app on my local iis it doesn't work.

    I've read Tim Heuer blog about hosting cross domain xap files but he says nothing about local hosted xap files

    http://timheuer.com/blog/archive/2010/06/10/troubleshooting-debugging-silverlight-cross-domain-xap-hosting.aspx

    I've googled it more but I didn't find anything else, is this a sort of unexplicable "security" feature of silverlight?

    Thursday, October 13, 2011 5:56 AM

All replies

  • I host the silvelight app on my local iis it doesn't work.

    Hi,

    How did you set the URL of the xap file in your local IIS?

    I think it should be like http://[your computer name]:[your port]/[your xap file path]

    Or you could check the Fiddler to check the details.

    Sunday, October 16, 2011 10:24 PM
  • Hi

    I've tried the following:

    http://127.0.0.1/myapp.xap

    http://localhost/myapp.xap

    http://mylocalhost/myapp.xap (with an entry in the host file to redirect mylocalhost to 127.0.0.1)

    In all the cases the xap file has not been downloaded, there was no request to download the xap file from my local iis.

    If I embed the silvelight app in the local page it will be downloaded but if I inject it with an user script in another page it will be ignored.

    Monday, October 17, 2011 2:17 PM
  • Hi,

    Did you add the mimetype to the IIS?

    Are you sure you followed all the three tips in the blog in your first post? HTML Access, MIME Type and ExternalCallersFromCrossDomain.

    If all yes, please try to use your computer name instead of the localhost and try again. You can see the computer name by right-click the Computer and click Properties.

    Monday, October 17, 2011 10:36 PM
  • Yes I checked everything and it works, if I host it in a external domain, this means htmlaccess (true) and the externalcallersfromcrossdomain (scriptableonly) are correct. When I host it locally, the xap file is not downloaded, so it isn't a problem of htmlaccess or externalcallsfromcrossdomain, the problem will never reach those points, the only thing that could be is the mime type, but I checked it many times and it's correct (application/x-silverlight-app), I can only think to a not specified security rule of silverlight.

    Tuesday, October 18, 2011 12:38 PM
  • externalcallersfromcrossdomain (scriptableonly) are correc

    Try to remove the  externalcallersfromcrossdomain and try.

    Wednesday, October 19, 2011 3:14 AM
  • Thanks for the reply

    I tried to use the computer name but the effect was the same then I removed the externalcallersfromcrossdomain but as said the xap file is not downloaded from the loacal IIS.

    If I set the xap file url as source of an image there is the request to the local IIS and in the response headers the mime type is correct (application/x-silverlight-app), so the url is working and the mime type is correct, it's the silverlight plug-in, which for some unexplicable reasons doesn't get the xap file.

    <img src="http://localhost/myxapfile.xap"/>

    --> Works

    <object data="data:application/x-silverlight-2," type="application/x-silverlight-2">

    <param name="source" value="http://localhost/myxapfile.xap"/>

    </object>

    --> Doesn't work

    <object data="data:application/x-silverlight-2," type="application/x-silverlight-2">

    <param name="source" value="http://myexternalprovider/myxapfile.xap"/>

    </object>

    --> Works

    Wednesday, October 19, 2011 1:37 PM
  • Hi,

    I've tested according to your description at my side, it all works fine for me.

    Please change the extension name, .xap to .zip and unzip the file, then you will see AppManifest.xaml, open it with the notepad.exe and check whether the markups like this:

    <Deployment xmlns="http://schemas.microsoft.com/client/2007/deployment" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" ExternalCallersFromCrossDomain="ScriptableOnly" EntryPointAssembly="SLNavSample" EntryPointType="SLNavSample.App" RuntimeVersion="4.0.50826.0">

    If not, you should modify the AppManifest.xml in the project by your Visual Studio.

    I could not get any other possible reason for your issue.
     

     

    Wednesday, October 19, 2011 11:42 PM
  • No it doesn't and here is the demo:

    http://spamme.comuf.com/HelloWorldTestPage.html

    You can download the xap file and put it to your local iis, it won't work!

    You can also download the html page and put it in the local iis and at this point it will work.

    Monday, October 24, 2011 1:58 PM
  • It works in windows xp but not in windows vista.

    I tried everything, from give all the rights to iis, to install apache, to start the browser (firefox and IE) with administrator rights, nothing!

    Does silverlight have a log file, something where you can check why it doesn't work?

    Tuesday, November 08, 2011 6:11 PM
  • Hi,

    Maybe try to run the IE as adminstrator: shift+ right-click the IE shortcut and then click Run as Administrator.

    Tuesday, November 08, 2011 9:26 PM
  • Thanks

    I have already tried it, but nothing, is there some parameters in the registry that can be changed to have some informations from the silverlight plugin? Is there a "debuging" version with log file of the silverlight plugin?

    Wednesday, November 09, 2011 5:57 PM