title: Unity loadConfiguration failing
body: <p>I have the following unity construct method:</p>
  
  <pre><code>public static IUnityContainer CreateContainer()
  {
      UnityContainer container = new UnityContainer();
      container.LoadConfiguration();
  
      .......
  }
  </code></pre>
  
  <p>Then an interface, and an implementation class:</p>
  
  <pre><code>namespace MyCompany.Web.Areas.MyApp.Common
  {
      public interface ISession
      {
      }
  }
  
  namespace MyCompany.Web.Areas.MyApp.Common
  {
      public class SessionHandler : ISession
      {
      }
  }
  </code></pre>
  
  <p>Instead of doing this:</p>
  
  <pre><code>Container.RegisterType&lt;ISession, SessionHandler&gt;(new ContainerControlledLifetimeManager()) ;
  </code></pre>
  
  <p>I want to use container.LoadConfiguration() to load the above RegisterType config from the web.config. <strong>BUT it doesn't seem to work</strong></p>
  
  <p>web.config:</p>
  
  <pre><code>  &lt;unity&gt;
      &lt;containers&gt;
        &lt;container&gt;
          &lt;types&gt;
  
            &lt;type type="MyCompany.Web.Areas.MyApp.Common.ISession" mapTo="MyCompany.Web.Areas.MyApp.Common.SessionHandler"&gt;
              &lt;lifetime type="singleton"/&gt;
            &lt;/type&gt;
          &lt;/types&gt;
        &lt;/container&gt;
      &lt;/containers&gt;
    &lt;/unity&gt;
  </code></pre>
  
  <p><strong>Exception:</strong></p>
  
  <p>The type name or alias MyProject.Web.Areas.MyApp.Common.ISession could not be resolved. Please check your configuration file and verify this type name. </p>
  
  <p><strong>Description:</strong> An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. </p>
  
  <p><strong>Exception Details:</strong> System.InvalidOperationException: The type name or alias MyProject.Web.Areas.MyApp.Common.ISession could not be resolved. Please check your configuration file and verify this type name.</p>
  
  <p><strong>Source Error:</strong> </p>
  
  <p>Line 33:         {
  Line 34:             UnityContainer container = new UnityContainer();
  Line 35:             container.LoadConfiguration();
  Line 36: 
  Line 37:            //container.RegisterType(new ContainerControlledLifetimeManager());</p>
  
  <p><strong>Stack Trace:</strong> </p>
  
  <blockquote>
    <p>[InvalidOperationException: The type name or alias MyProject.Web.Areas.MyApp.Common.ISession could not be resolved. Please check your configuration file and verify this type name.]
       Microsoft.Practices.Unity.Configuration.ConfigurationHelpers.TypeResolverImpl.ResolveType(String typeNameOrAlias, Boolean throwIfResolveFails) in e:\Builds\Unity\UnityTemp\Compile\Unity\Unity.Configuration\Src\ConfigurationHelpers\TypeResolverImpl.cs:110
       Microsoft.Practices.Unity.Configuration.ConfigurationHelpers.TypeResolver.ResolveType(String typeNameOrAlias) in e:\Builds\Unity\UnityTemp\Compile\Unity\Unity.Configuration\Src\ConfigurationHelpers\TypeResolver.cs:47
       Microsoft.Practices.Unity.Configuration.RegisterElement.GetRegisteringType() in e:\Builds\Unity\UnityTemp\Compile\Unity\Unity.Configuration\Src\RegisterElement.cs:121
       Microsoft.Practices.Unity.Configuration.RegisterElement.ConfigureContainer(IUnityContainer container) in e:\Builds\Unity\UnityTemp\Compile\Unity\Unity.Configuration\Src\RegisterElement.cs:88
       Microsoft.Practices.Unity.Configuration.ContainerConfiguringElement.ConfigureContainerInternal(IUnityContainer container) in e:\Builds\Unity\UnityTemp\Compile\Unity\Unity.Configuration\Src\ContainerConfiguringElement.cs:43
       Microsoft.Practices.Unity.Configuration.&lt;>c__DisplayClass1.b__0(ContainerConfiguringElement element) in e:\Builds\Unity\UnityTemp\Compile\Unity\Unity.Configuration\Src\ContainerElement.cs:114
       Microsoft.Practices.ObjectBuilder2.EnumerableExtensions.ForEach(IEnumerable<code>1 sequence, Action</code>1 action) in e:\Builds\Unity\UnityTemp\Compile\Unity\Unity\Src\ObjectBuilder\Utility\EnumerableExtensions.cs:36
       Microsoft.Practices.Unity.Configuration.ContainerElement.ConfigureContainer(IUnityContainer container) in e:\Builds\Unity\UnityTemp\Compile\Unity\Unity.Configuration\Src\ContainerElement.cs:110
       Microsoft.Practices.Unity.Configuration.UnityConfigurationSection.Configure(IUnityContainer container, String configuredContainerName) in e:\Builds\Unity\UnityTemp\Compile\Unity\Unity.Configuration\Src\UnityConfigurationSection.cs:151
       Microsoft.Practices.Unity.Configuration.UnityContainerExtensions.LoadConfiguration(IUnityContainer container, UnityConfigurationSection section, String containerName) in e:\Builds\Unity\UnityTemp\Compile\Unity\Unity.Configuration\Src\UnityContainerExtensions.cs:37
       Microsoft.Practices.Unity.Configuration.UnityContainerExtensions.LoadConfiguration(IUnityContainer container) in e:\Builds\Unity\UnityTemp\Compile\Unity\Unity.Configuration\Src\UnityContainerExtensions.cs:64
       MyProject.Web.ApplicationContainer.CreateContainer() in C:\Workspace\MCDev\MyApp\MyApp\MyProject.Web\ApplicationContainer.cs:35
       MyProject.Web.ApplicationContainer.Initialize(HttpContext context) in C:\Workspace\MCDev\MyApp\MyApp\MyProject.Web\ApplicationContainer.cs:53
       MyProject.Web.MvcApplication.Application_Start() in C:\Workspace\MCDev\MyApp\MyApp\MyProject.Web\Global.asax.cs:41</p>
  </blockquote>