I was trying to apply subdomain redirection on a website, say website1(subdomain1.website1.com). For that I copied the whole code of another website (website2), pasted it in a folder under the root of website1 (website1.com/folder1).
I was planning to redirect subdomain1.website1.com to website1.com/folder1 with masking.
When I typed website1.com/folder1 I got this 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.
The reason was folder1 not being configured as an application on IIS 7.5.
To configure a folder as an application you should do the following:
1-Open the IIS Manager
2-Right-click on your folder
3-Click “Convert to Application”
If your case is the same, your problem should be gone now.
Hope this helps someone.