Yellow Screen of Death Error:
Could not load file or assembly [Assembly Name Here] or one of its dependencies.
The Gripe
I hate this error because it is very misleading with respect to visual studio. You compile and re-reference your code to no avail. I have seen this error RANDOMLY appear for no good reason I could EVER find. I have gotten very good at knowing when this error is a load of bull and when it is a legitimate error. It is a legitimate error in the sense that it is indeed happening, but it really means that IIS7 choked again (surprise surpise).
Why does this happen?
This error can crop up after a physical traumatic computer event such as a random shut down, loss of power, blue screen of death (BSOD) or any variation of those. Either way it @#!#$ up IIS and makes it go stupid. I have seen this error crop up all on its own before without anything ridiculous happening to my host machine before. The cache does just get mucked up.
The Gotcha
No amount of recompiling your code will fix this. The only thing that can happen is that IIS somehow cleans its self up appropriately on its own. You must clean out the IIS Temporary Files.
The Fix
At this point you need to clean out IIS’s Temporary Files, as a necessary and paranoid precaution you should clean out all caches regardless of what version of .Net version you are running. I cannot prove this, but for whatever reason windows likes to make copies of your Temp Files in both main flavors of .Net. Why? I am not sure.
- Very important, open up cmd and stop IIS. Start > Run > cmd > iisreset /stop
- Delete the suspect folders** for your application from the following folders. If you are unsure which folder to delete then just delete them all. It is harmless (usually) to do so since these are just cached versions of your sites and applications. Your working copy (your code) is copied here after compilation by IIS for run time which is one of the reasons why you can’t just drop in a dll during run time in production because it has to re-cache your files which kills your application pool.
x86 v2.0 C:WindowsMicrosoft.NETFrameworkv2.0.50727Temporary ASP.NET Files x86 v4.0 C:WindowsMicrosoft.NETFrameworkv4.0.30319Temporary ASP.NET Files x64 v2.0 C:WindowsMicrosoft.NETFramework64v2.0.50727Temporary ASP.NET Files x64 v4.0 C:WindowsMicrosoft.NETFramework64v4.0.30319Temporary ASP.NET Files - Assuming your cmd window is still open – start IIS. Start > Run > cmd > iisreset /start
Please bare in mind that your site needs to re-cache itself, this can take sometime depending on the size of your site, so be patient. In order to initiate the re-caching effort, just navigate to your site and that will start up the w3wp.exe process which will automatically start caching your site.