今天遇到了這個錯誤。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中多定義了一個 <authentication mode="Windows"/>
將其蔽掉,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 <authentication mode../> 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.
說 像<authentication mode../> or <sessionState..> 這樣的東東需要一個Application中繼資料。 但是你卻沒有定義。解決方案是:要不你就把你web.config中的這樣的東西去掉,要不你就在 Home Directory, Virtual Directory, or Directory properties 那裡建立一個對應的web site,虛擬目錄和目錄。那些東西至少要有Script訪問級和Read的許可權。