Asp.net
為什麼 IIS Express 使用 <system.web> 而不是 <system.webServer>?
使用 Cassini 但切換到 IIS Express。我最初的想法是我可以刪除
<system.web>除以下內容之外的所有內容:<authentication mode="Forms"> <forms loginUrl="/" /> </authentication>我以前
customErrors的設置是這樣的:<customErrors mode="On" defaultRedirect="/ServerError"> <error statusCode="404" redirect="/NotFound" /> </customErrors>
customErrors當我切換到 IISExpress 時,我刪除了這個元素。現在 404 不再重定向到我漂亮的“未找到”頁面。用於我的網站的 AppPool
Clr4IntegratedAppPool讓我知道它沒有使用 Classic。為什麼 IISExpress 如此依賴
system.web而 IIS 7.5 使用system.webServer?
好吧,我嘗試了一些不同的方法:
- 更改
existingResponse為PassThrough如here所述
<httpErrors errorMode="Custom" existingResponse="Replace">沒有!
- 設置
TrySkipIisCustomErrors=false如評論中所述請注意!
我最終通過簡單地將其更改
existingResponse為Replace.
- 誰知道!
這是
system.webServer現在的樣子:<httpErrors errorMode="Custom" existingResponse="Replace"> <remove statusCode="404" subStatusCode="-1" /> <error statusCode="404" path="/NotFound" responseMode="ExecuteURL" /> <remove statusCode="500" subStatusCode="-1" /> <error statusCode="500" path="/ServerError" responseMode="ExecuteURL" /> </httpErrors>為什麼這個解決方案沒有任何意義
Replace - 此值使自定義錯誤模組始終將錯誤資訊替換為自定義錯誤模組生成的文本。如果現有響應設置為“替換”,則由 Asp.Net/WCF 生成的錯誤/異常將被 IIS7 錯誤替換。
http://blogs.iis.net/ksingla/archive/2008/02/18/what-to-expect-from-iis7-custom-error-module.aspx