views:

61

answers:

1

Hello,

I am an enthousiastic (new) user of structuremap but I am experiencing a problem loading registries.

When I start my application from a local drive all the registries in my application are used to resolve types. I verified this by ObjectFactory.WhatDoIHave() However when I start the same application from a share then not all registries are loaded. It seems only the registries that are currently loaded in the appdomain are used to register types. The weird thing is that the application did work. Recently I upgraded my application from .Net 3.5 to 4.0, maybe this has something to do with it.

This is what I found until now, could this be the problem? http://stackoverflow.com/questions/2765221/assembly-loadfrom-permissioning-in-net-4-0

my code to register my registries is:

var _container = new Container(x =>
            {
                x.Scan(
                    scan =>
                    {
                        scan.AssembliesFromApplicationBaseDirectory();
                        scan.LookForRegistries();
                    });
            });
+1  A: 

I was able to solve this problem myself. The problem is explained here: http://msdn.microsoft.com/en-us/magazine/ee677170.aspx I added the following to my .config file and then it worked like a charm:

<configuration>
  <runtime>
    <!-- WARNING: will load assemblies from remote locations as fully trusted! -->
    <loadFromRemoteSources enabled="true" />
  </runtime>
</configuration>
Ruben