This error can be caused by a virtual directory not being configured as an application in IIS.
you can have web.config file for the sub-directory. However, there are certain properties which cannot be set in the web.config of the sub-directory such as authentication, session state. The reason is, these settings cannot be overridden at the sub-directory level unless the sub-directory is also configured as an application.
Original Source :
here[
^].
--Amit