Cause:
For me this error came when i tried to install my ASP.net 2.0 website built on 32 bit on a server which was 64 bit.
Solution:
Open your IIS Manager (in my case it was 7.5) and then right click on application pool to have advance settings and make enable 32 bit application to TRUE.