On attempting to deploy a .net 3.5 website on the default app pool in IIS7 having the framework section set to 4.0, I get the following error.
There i
Necromancing.
If you don't have any system.web.extensions config-sections or handler/module entries in your web.config, this problem is caused because you/somebody else copied a VisualStudio-Project (2013/2015/2017) while having hidden-files unhidden.
Because of that, it will not only copy .git, but also .VS, which contains an IIS-Express applicationhost.config file, which points to web.config files at paths that don't exist (or worse, paths that do exist, but do not have the same content)...
Solution:
Delete the applicationhost.config file in the .VS folder.
Or just delete the .VS folder altogether.
Visual Studio will re-create it.