It Is an Error to Use a Section Registered allowDefinition='MachineToApplication' Beyond Application Level

今天遇到了这个错误。Parser   Error   Message:   It   is   an   error   to   use   a
section   registered   allowDefinition=‘MachineToApplication’   beyond
application   level.   This   error   can   be   caused   by   a   virtual
directory   not   being   configured   as   an   application   in   IIS.”

发现是在web.config中多定义了一个

将其蔽掉,ok。

在msdn上的英文解释:

Q:   We   have   a   fully   patched   IIS   5   server   and   are
receiving   the   following   error   “Parser   Error   Message:   It   is
an   error   to   use   a   section   registered
allowDefinition=‘MachineToApplication’   beyond   application   level.   This
error   can   be   caused   by   a   virtual   directory   not   being
configured   as   an   application   in   IIS.”   Can   you   explain   what
this   means?

A:   I   love   these   verbose   Asp.net   error   messages!   They   often
direct   you   to   the   solution   as   well   as   describe   the
problem.   You’ll   see   this   error   when   your   Asp.net   application
is   configured   such   that   it   uses   a   feature   like
  or   <sessionState…>   that   requires   an
“Application”   be   defined   in   the   metabase,   and   that   definition
is   missing.   You   can   correct   this   by   either   removing   such
settings   from   your   web.config   files,   or   by   clicking   “Create”
on   the   Home   Directory,   Virtual   Directory,   or   Directory
properties   tab   of   a   web   site,   virtual   directory,   or
directory,   respectively.   This   location   will   require   at   least
the   Scripts   Only   permission   and   Read   permissions   as   well.

说 像   or   <sessionState…>
这样的东东需要一个Application元数据。 但是你却没有定义。解决方案是:要不你就把你web.config中的这样的东西去掉,要不你就在  Home
Directory,   Virtual   Directory,   or   Directory   properties   那里创建一个对应的web
site,虚拟目录和目录。那些东西至少要有Script访问级和Read的权限。