AppDomain assemblies not being loaded correctly.

Posted by SharePoint Newbie on Stack Overflow See other posts from Stack Overflow or by SharePoint Newbie
Published on 2010-05-25T15:57:52Z Indexed on 2010/05/25 16:01 UTC
Read the original article Hit count: 180

Filed under:
|

Hi,

We are doing the following in the Application_Start (Global.ascx.cs) for a WCF Service hosted by IIS 7.0 (integrated pipeline).

        var mapperConfigurations = AppDomain.CurrentDomain.GetAssemblies()
            .SelectMany(a => a.GetExportedTypes().Where(t => typeof (IMapperConfiguration).IsAssignableFrom(t) && t.IsClass))
            .ToList();

The web-service has 8-10 assemblies in its bin folder and each of them have multiple implementations of IMapperConfiguration. After an IIS Reset, no mapper configurations are found (found this using debug.write). However, this behaviour is inconsistent and at other times all implementations of IMapperConfiguration are found.

When exactly does IIS load assemblies and what is wrong with this code?

Thanks

© Stack Overflow or respective owner

Related posts about c#

Related posts about iis7