Error: It is an error to use a section registered as allowDefinition=’MachineToApplication’ beyond application level. This error can be caused by a virtual directory not being configured as an application in IIS.

Error: It is an error to use a section registered as allowDefinition=’MachineToApplication’ beyond application level

Cause: Such error is usually due to a project opened as a Website

Solution: Close Application and open sln (solution file)  or all files as Open Project not Open Website.