Configuration error when executing an application in a subdirectory

If you get the following error when attempting to execute an application in a sub directory:
 
Parser Error Message: 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.

It could be that your application is being run out of a subfolder and the subfolder is not configured in IIS to run as an application. 
 
To resolve this error, you can create an IIS application starting point in the Site Tools section of Control Panel