'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'

When you get this error during building your web application in Visual Studio and you already tried to do these two solutions:- Set you directory as an application in IIS- When you have nested web.config files. Remove or rename the one in a folder below or above your application directory.

You can try the following:- Remove the obj folder in your sources directory and rebuilt the solution again.