Since I upgraded my file-based web site from ASP.NET 3.5 to 4.0 (including Entity Framework 4), I’ve been getting the following error message far too often:
Unable to load one or more of the requested types.
Here’s the scenario: I FTP a bunch of new files to the site – especially a large Entity Framework model. On the first page access, the .NET compiler detects the changes and builds the new files. I assume that the on-the-fly compiling is either unfinished or out of sync when this error strikes.
Sometimes, I make a trivial change to the web.config file to give it another kick. That doesn’t always work, so I end up stopping and restarting IIS.
The compilation failures are annoying enough but they’re aggravated by the confusing advice on how to debug the issue:
Retrieve the LoaderExceptions property for more information.
Well, this is being built on the fly and I don’t know where to look for the error. The Event Log shows about the same info as I see on the error screen. Why doesn’t the error message just dump the LoaderExceptions details to the screen for me to read?
BTW, the unhelpful error message also appears when I’ve done something stupid – like adding a new field to my local copy of the database, pointing EF to it, and then forgetting to add the new field to the remote database.
BTW2, I know I could avoid much of the compiler aggravation by using a Web application and pre-building a single DLL. I originally adopted the file-based technique because my clients wanted to see frequent updates (almost hourly at first!). It was faster and easier to copy one or two source files than a big binary each time.
Ah, the joys of working from home, living in the woods, overlooking a lake and struggling with satellite Internet. (Don’t get me started about HughesNet’s brutal ‘fair access policy’.)