title: ASP.NET MVC 2 with NServiceBus unable to load requested types
body: <p>I am trying to use NServiceBus with an ASP.NET MVC 2 website (using VS 2010 and the .NET 4.0 framework).  However, when I run the site on my local machine, I get the following error: </p>
  
  <blockquote>
    <p>Unable to load one or more of the requested types. Retrieve the LoaderExceptions property for more information.</p>
  </blockquote>
  
  <p>Here are the relevant steps I have taken:</p>
  
  <ul>
  <li>Downloaded the NServiceBus.2.0.0.1145 binaries</li>
  <li>In my asp.net mvc app, I've added references to NServiceBus.dll and NServiceBus.Core.dll</li>
  <li>In Global.asax.cs I've added:</li>
  </ul>
  
  <blockquote>
  <pre><code>public static IBus Bus { get; private set; }
  protected void Application_Start()
  {
      AreaRegistration.RegisterAllAreas();
      RegisterRoutes(RouteTable.Routes);
  
      Bus = NServiceBus.Configure
          .WithWeb()
          .Log4Net()
          .DefaultBuilder()
          .XmlSerializer()
          .MsmqTransport()
              .IsTransactional(false)
              .PurgeOnStartup(false)
          .UnicastBus()
              .ImpersonateSender(false)
          .CreateBus()
          .Start();
  }
  </code></pre>
  </blockquote>
  
  <ul>
  <li>In web.config, I've added:</li>
  </ul>
  
  <blockquote>
  <pre><code>&lt;MsmqTransportConfig 
    InputQueue="MyWebClient" 
    ErrorQueue="error" 
    NumberOfWorkerThreads="1" 
    MaxRetries="5"/&gt;
  
  &lt;UnicastBusConfig&gt;
    &lt;MessageEndpointMappings&gt;
      &lt;add Messages="Messages" Endpoint="MyServerInputQueue"/&gt;
    &lt;/MessageEndpointMappings&gt;
  &lt;/UnicastBusConfig&gt;
  </code></pre>
  </blockquote>
  
  <p>The error indicates that the problem is with the first line in the Global.asax.cs file.  Is it possible that there is a problem with NServiceBus running under .NET 4.0?</p>