Asp.net-Mvc-5

關閉/禁用 asp.net-mvc 的 Windows 身份驗證

  • November 27, 2020

我創建了一個新的 asp.net-mvc 項目,在安裝過程中我選擇使用 Windows 身份驗證。

現在我喜歡關掉它(至少一段時間)。

我將 web.config 更改為此

<authentication mode="None" />

但這確實改變了任何事情。它仍然會提示我。我正在使用 IIS Express。

更新:我的意思是在使用 Firefox 時它仍然會提示我。Internet Explorer 將繼續執行並且不顯示我的域使用者名

Web 配置應該覆蓋 IIS express 配置,但在這種情況下,它似乎沒有。您可以嘗試做的是在 IIS 級別也將其關閉。

你可以到這個目錄 \IISExpress\config\applicationhost.config 打開這個文件並設置 <windowsAuthentication enabled="false" />.

1.) 關閉 VS

2.) 刪除解決方案旁邊的.vs/config或文件夾。.vsIIS Express 重新生成該config/applicationhost.config文件。更改此文件無濟於事 - 它會重新生成

3.) 編輯<project>.csproj.user文件。那裡換線

<IISExpressAnonymousAuthentication>disabled</IISExpressAnonymousAuthentication>
<IISExpressWindowsAuthentication>enabled</IISExpressWindowsAuthentication>

<IISExpressAnonymousAuthentication>enabled</IISExpressAnonymousAuthentication>
<IISExpressWindowsAuthentication>disabled</IISExpressWindowsAuthentication>

4.) 編輯和更改 web.config 更改

<authentication mode="Windows" />

<authentication mode="None" />

或註釋整個身份驗證 XML 元素。

引用自:https://stackoverflow.com/questions/26910724