Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7733731
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T07:04:37+00:00 2026-06-01T07:04:37+00:00

I’ve an MEF application that works great when run locally, but doesn’t work when

  • 0

I’ve an MEF application that works great when run locally, but doesn’t work when called remotely on a network share.

I’m using Assembly.LoadFrom to avoid UNC issues, but seeing as all the dlls are situated next to the exe I didn’t really think this would be the problem, but I tried it any way.

I also fixed the ConfigurationManager.GetSection issues, that seems to be a common problem with .NET 4 permissions, after looking on msdn.

I’m allowing <loadFromRemoteSources enabled="true"/> in the config file. So I’m not sure where the problem could be.

Edit: The ProductDispatcher in the exception is definitey in the catalog.Parts.

The code setting up the container and catalog:

var catalog = new AggregateCatalog();

var dir = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);

foreach (string file in Directory.GetFiles(dir, "XXX*.dll"))
{
    var assembly = Assembly.LoadFrom(file);
    catalog.Catalogs.Add(new AssemblyCatalog(assembly));
}

var container = new CompositionContainer(catalog);
var batch = new CompositionBatch();
batch.AddPart(this);
container.Compose(batch);

The Import is (which I have tried making public):

[ImportMany(typeof(IEntityTypeDispatcher))]
private IEnumerable<IEntityTypeDispatcher> Dispatchers { get; set; }

An example of an export is:

[Export(typeof(IEntityTypeDispatcher))]
internal class ContactDispatcher : EntityTypeDispatcher<Contact>

The exception error I get is:

The composition produced a single composition error. The root cause is provided below. Review the CompositionException.Errors property for more detailed information.

1) Unable to load one or more of the requested types. Retrieve the LoaderExceptions property for more information.

Resulting in: An exception occurred while trying to create an instance of type 'XXX.XXX.Dispatch.ProductDispatcher'.

Resulting in: Cannot activate part 'XXX.XXX.Dispatch.ProductDispatcher'.
Element: XXX.XXX.Dispatch.ProductDispatcher -->  XXX.XXX.Dispatch.ProductDispatcher -->  AssemblyCatalog (Assembly="XXX.XXX, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null")

Resulting in: Cannot get export 'XXX.XXX.Dispatch.ProductDispatcher (ContractName="XXX.XXX.Dispatch.IEntityTypeDispatcher")' from part 'XXX.XXX.Dispatch.ProductDispatcher'.
Element: XXX.XXX.Dispatch.ProductDispatcher (ContractName="XXX.XXX.Dispatch.IEntityTypeDispatcher") -->  XXX.XXX.Dispatch.ProductDispatcher -->  AssemblyCatalog (Assembly="XXX.XXX, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null")

Resulting in: Cannot set import 'XXX.XXX.Dispatch.DispatcherRepository.Dispatchers (ContractName="XXX.XXX.Dispatch.IEntityTypeDispatcher")' on part 'XXX.XXX.Dispatch.DispatcherRepository'.
Element: XXX.XXX.Dispatch.DispatcherRepository.Dispatchers (ContractName="XXX.XXX.Dispatch.IEntityTypeDispatcher") -->  XXX.XXX.Dispatch.DispatcherRepository
 (System.ComponentModel.Composition.CompositionException)

   at System.ComponentModel.Composition.CompositionResult.ThrowOnErrors(AtomicComposition atomicComposition)
   at System.ComponentModel.Composition.Hosting.ComposablePartExportProvider.Compose(CompositionBatch batch)
   at System.ComponentModel.Composition.Hosting.CompositionContainer.Compose(CompositionBatch batch)
   at XXX.XXX.Dispatch.DispatcherRepository.LoadDispatchers() in D:\Workspaces\XXX\Branches\Dev1\XXX.XXX\XXX.XXX\Dispatch\DispatcherRepository.cs:line 71
   at XXX.XXX.Dispatch.DispatcherRepository.get_Instance() in D:\Workspaces\XXX\Branches\Dev1\XXX.XXX\XXX.XXX\Dispatch\DispatcherRepository.cs:line 34
   at XXX.XXX.Dispatch.DispatcherRepository.GetDispatchers() in D:\Workspaces\XXX\Branches\Dev1\XXX.XXX\XXX.XXX\Dispatch\DispatcherRepository.cs:line 21
   at XXX.XXX.Dispatch.Dispatcher.get_Instance() in D:\Workspaces\XXX\Branches\Dev1\XXX.XXX\XXX.XXX\Dispatch\Dispatcher.cs:line 30
   at XXX.XXX.Broker..ctor() in D:\Workspaces\XXX\Branches\Dev1\XXX.XXX\XXX.XXX\Broker.cs:line 52

It seems to be that MEF doesn’t work too well in partial trust scenarios. Is there anything I need to do to ensure everything is running under full trust?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-01T07:04:38+00:00Added an answer on June 1, 2026 at 7:04 am

    Although you have enabled “load from remote sources”, this might be occurring because the files may still have restrictions on them.

    NTFS supports the ability to apply metadata to a file in an alternate data stream (ADS). This will include the Zone information (e.g. Internet Zone, etc.).

    This might be what is causing issues with your network-located files, they may be classified in the Internet Zone, and therefore are still potentially being blocked.

    Check out this article and see if this will resolve it for you: http://mikehadlow.blogspot.co.uk/2011/07/detecting-and-changing-files-internet.html

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a French site that I want to parse, but am running into
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
link Im having trouble converting the html entites into html characters, (&# 8217;) i
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I want to count how many characters a certain string has in PHP, but
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I've got a string that has curly quotes in it. I'd like to replace
I am doing a simple coin flipping experiment for class that involves flipping a
I would like to run a str_replace or preg_replace which looks for certain words
I need to clean up various Word 'smart' characters in user input, including but

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.