Could not load file or assembly … HRESULT: 0x80070057 (E_INVALIDARG)

Wow, this error just cost me 40 minutes of my life. I was forced to hard-reset my computer and when it rebooted, trying to load my primary IIS dev site gave this error. It names a specific DLL, but that’s a red-herring. The specific DLL is irrelevant. In my case, it was a 3rd party DLL that worked fine when I switched IIS to a different site, so I knew it wasn’t the problem.

Searching reveals this thread on the MSDN social site. It says to delete the contents of “Temporary ASP.NET Files” folders. There are several locations if you want to be really thorough. Note that the last one is the one I had missed and was causing me grief:

C:\Users\<UserName>\AppData\Local\Temp\Temporary ASP.NET Files

The Framework64 v4 directory is where my culprit files were located. I’m running Windows 8.1 64 bit and Visual Studio 2012.

tl;dr: delete your .NET temp file directories, and don’t forget Framework64!

4 thoughts on “Could not load file or assembly … HRESULT: 0x80070057 (E_INVALIDARG)”

    1. Hi zahra,

      Unfortunately I haven’t seen this error in a very long time. I’d check StackOverflow and look for directories in addition to the ones I listed in case future versions have increased the number. Finally, I would clean and rebuild the solution.


Leave a Reply

Your email address will not be published. Required fields are marked *