I had a situation where the IIS reported that the targetFramework=4.0 attribute was not supported.
I’m not sure why it started reporting it, but I fixed it with this:
%windir%\Microsoft.NET\Framework\v4.0.21006\aspnet_regiis.exe -i