Am playing with ASP.NET MVC these days in preparation for a couple o' presentations on it. Jeffrey Palermo's CodeCampServer sample app has proven invaluable in this regard even if I have become overly cognizant that I'm ripping off his ideas.
In my own version, I'm also referencing NHibernate in my data access layer and whenever I do that, I always forget which assemblies it requires to tag along with it. In my sample, I brought over NHibernate.dll, Iesi.Collections.dll, and log4net.dll into my lib folder and added the reference to NHibernate.dll from the project. Wired up all my repositories, hooked in the IoC container (in this case, Windsor) and loaded the page:
Unable to load one or more of the requested types. Retrieve the LoaderExceptions property for more information.
Description: 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.
Exception Details: System.Reflection.ReflectionTypeLoadException: Unable to load one or more of the requested types. Retrieve the LoaderExceptions property for more information.
Not overly helpful and although my lead-up to this has made it painfully obvious, let me tell you when you've also added the IoC container and three other layers 'twixt the UI and the DataAccess layer, 'tweren't altogether clear just what was causing this problem.
In fact, even when I reverted all the code in the control back to use the simplest possible controller action, I still got this error. The reason being: I still had the reference to the DataAccess project as well as the references to its classes in the Windsor container. Which means it was still trying to load NHibernate.
And NHibernate (or at least the version of it I have) requires, along with the other assemblies mentioned above, a reference to Castle.DynamicProxy.dll. So I dropped the assembly into the lib folder and it came along for the ride the next time I compiled. Problem solved. Reminder stored.
Kyle the Proxied