OOB and multiple modules with MEF

Topics: Prism v4 - Silverlight 4
Mar 17, 2012 at 3:36 PM

Is it possible to make it work and how?

I want to allow OOB install just for convenience while letting people use my SL5 application in-browser. I'm using MEF to load modules (XAP files) on a fly and it works great. However, when I install OOB - modules don't get loaded. Where should I look and what should I do to make it work?

 

SL5 + PRISM 4.1

Developer
Mar 19, 2012 at 9:34 PM
Edited Mar 19, 2012 at 9:36 PM

Hi,

As mentioned in the documentation if you plan to run your Silverlight application Out-Of-Browser (OOB), the user will first need to access the application with the browser via its hosting page; after that, the user can then optionally install the application for OOB use. As a result, the deployment of a Silverlight Prism application is mostly a matter of getting your XAP files in the right place on a web server so the hosting page can download and run them.

One thing to take into account, to avoid cross-domain call issues,is that the remote modules' XAP files should be located on the same domain as the main application; when deployed like this, the Ref property on the ModuleCatalog should be a Uniform Resource Identifier (URI) relative to the main XAP file location on the web server.

More information about this can be found in Chapter 11: Deploying Prism Applications, of the Prism documentation

Based on this, I tested the Modularity Quickstart with MEF, Prism 4.1 and Silverlight 5 OOB and didn't find any problem.

The only scenario where I found modules in different XAP files were not loaded was if running the OOB application offline, since the application cannot obtain the XAP files from the web server and any XAP that don’t appear in the main application isn’t added to the out-of-browser cache.

Possible approaches to workaround this could be:

  • Creating a custom XapModuleTypeLoader that will download to Isolated Storage and check there first for .xap files. After the files are cached the OOB application should be able to load the modules
  • Include modules in the main .xap

You might find an example of this, but using Unity in the following blog post:

On the other hand, another possible reason that could be causing your problem could be a reported issue when running Silverlight applications from out of browser, you could find more information in the following thread:

I hope you find this helpful,

Agustin Adami
http://blogs.southworks.net/aadami


Mar 19, 2012 at 9:53 PM
Edited Mar 19, 2012 at 10:01 PM

I wonder if it has to do with the fact that I run my app over SSL? The way I have my app setup - I have main module in separate XAP. So, shell itself doesn't do much. It loads System module which does authentication and proceeds with loading other modules.

I have all XAPs in a same ClientBin folder.

Developer
Mar 20, 2012 at 8:44 PM

Hi,

In my opinion, as a start point, you could try using a tool like fiddler or a similar one that will help you obtain more information about the failing request which might be useful for finding the cause of this problem. More information about this and other similar tools can be found in the following blog:

So far, with the information you provided, we believe this could be caused by a Cross-domain issue or a Cross-scheme issue if you request the page via http, but your page will try to access via https.

Regarding this, you could find useful information about security policies that can restrict network communications in your Silverlight application and additional restrictions that are in place when accessing URL resources in the following links:

Regards,

Agustin Adami
http://blogs.southworks.net/aadami