“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.”
If you are working on a SharePoint application page project then this error is most likely because you have a web.config file in your project.
- Don’t deploy the web.config to the LAYOUTS folder
- Or if you need the web.config for any reason (testing, etc) then delete the authentication section: