Whilst setting up a new build server I came across the following error internal error 500, code 0x80070021 from IIS (I was setting up CruiseControl.net, but I assume this isn’t specific to that application).
It seems this is down to the handlers being locked in IIS, running the following fixed this issue
%windir%\system32\inetsrv\appcmd.exe unlock config -section:system.webServer/handlers