I recently installed visual studio 2010 and then installed IIS server. But when I tried to run a aspx application it gave this error.
I found that because of not registering ASP.NET properly. So I ran the reg command and it worked for me.
the bold one represent your framework version.