One of the reason is already listed in error itself: This error can be caused by a virtual directory not being configured as an application in IIS
Configure the website properly and check. In case it is configured correctly, this also happens when you have more than one Web.Config file in your application root folder. Just check if you have more than one. If so, remove the duplicate copies.
Read a similar issue resolved here:ASP.NET 2.0 & "allowDefinition='MachineToApplication'" error message
Other useful link that has similar issue discussed: http://forums.asp.net/p/769696/769696.aspx