同一目錄下把多個網站預設不同文件當首頁。
在 command 執行以下指令:
%windir%\system32\inetsrv\appcmd.exe set config "Default Web Site/portal" -section:system.webServer/defaultDocument -+files.[value='index.aspx'] -commitpath:apphost
%windir%\system32\inetsrv\appcmd.exe set config "Default Web Site/web" -section:system.webServer/defaultDocument -+files.[value='ErrorPage.htm'] -commitpath:apphost
出現以下訊息:
已將設定變更套用至設定認可路徑 "MACHINE/WEBROOT/APPHOST" 中 "MACHINE/WEBROOT/APP
HOST/Default Web Site/portal" 的區段 "system.webServer/defaultDocument"。
已將設定變更套用至設定認可路徑 "MACHINE/WEBROOT/APPHOST" 中 "MACHINE/WEBROOT/APP
HOST/Default Web Site/web" 的區段 "system.webServer/defaultDocument"。
如果無法順利執行,將 web.config 更名,強制使用 applicationHost.config 設定即可。
C:\Windows\System32\inetsrv\config\applicationHost.config
<location path="Default Web Site/portal">
<system.webServer>
<defaultDocument>
<files>
<add value="index.aspx" />
</files>
</defaultDocument>
</system.webServer>
</location>
<location path="Default Web Site/web">
<system.webServer>
<security>
<access sslFlags="None" />
</security>
<defaultDocument>
<files>
<add value="ErrorPage.htm" />
</files>
</defaultDocument>
</system.webServer>
</location>
C:\Windows\System32\inetsrv\config
如果不小心改了之後才發現沒有備份,C:\inetpub\temp\appPools 會有先前的暫存檔。
web.config 需取消以下設定,否則會因重複設定而發生錯誤。
<defaultDocument>
<files>
<clear />
<add value="Login.aspx" />
</files>
</defaultDocument>
留言列表