我正在訓練我的web.config以識別最佳默認文件是什麼。根據我的主機,它應該看起來像下面的列表。元素'system.web'具有無效的子元素'defaultDocument'
<?xml version="1.0"?>
<!--
For more information on how to configure your ASP.NET application, please visit
http://go.microsoft.com/fwlink/?LinkId=169433
-->
<configuration>
<appSettings/>
<system.web>
<defaultDocument>
<files>
<clear />
<add value="Defalut.aspx" />
</files>
</defaultDocument>
<compilation debug="true" targetFramework="4.0"/>
<httpRuntime/>
<pages controlRenderingCompatibilityVersion="4.0"/>
<machineKey/>
<customErrors defaultRedirect="Error.aspx" mode="On"/>
</system.web>
</configuration>
問題是VS2012(Express)將其標記爲藍色並聲稱在主題中出現錯誤。首先我認爲我可以上傳它,因爲它是通過蠻力使服務器喜歡的文件,但隨後它生氣了,吐出以下
HTTP錯誤500.19 - 內部服務器錯誤 請求的頁面不能因爲該頁面的相關配置數據無效,因此被訪問。
當我讀取錯誤消息時,它說:「配置節'defaultDocument'無法讀取,因爲它缺少一個節聲明。」
我已經完成了我的功課,發現下面的文章,但由於我的情況限制(例如我需要手動上傳web.config文件,我不能在我的託管服務器上運行任何腳本公司),這是無濟於事。
我該如何殺死這個小問題?
對拼寫錯誤檢測的讚揚。好眼睛! – 2012-07-16 01:16:31
我按照你的要求做了(不需要做任何改動),並使它與web.config的「新鮮」版本一起工作。然後我添加了defaultDocument標籤,並在下一條評論中收到了我要粘貼的消息。 – 2012-07-16 01:17:43
元素'system.web'具有無效的子元素'defaultDocument'。預期可能的元素列表: – 2012-07-16 01:19:07