When you use VS2010 to create a new website located on Local IIS, the following error sometimes happens.
I believe that this would happen when your have installed VS2010 first before installing Windows IIS.
Here is the command to register ASP.NET 4.0 to IIS:
Installs ASP.NET 4 and updates existing applications to use the ASP.NET 4 version of the application pool. It updates both the IIS Classic mode and the IIS Integrated mode handler and script mappings in the IIS metabase.
This option creates two application pools, ASP.NET v4.0 and ASP.NET v4.0 Classic. The DefaultAppPool application pool and the Classic .NET AppPool application pools are set to the .NET Framework 4 version of the CLR.