2012-10-24 26 views
1

我正在使用完美工作的測試服務器上的MVC應用程序。它在第二個應用程序用於登錄的服務器上創建帳戶。它使用憑證存儲和PrincipalContext和UserPrincipal對象來創建這些帳戶。在IIS 7.5 MVC應用程序中拒絕訪問

我還沒有使用這個應用程序的測試版本數月或可能將近一年。現在,當我去與應用程序創建一個帳戶,我收到以下錯誤:

Access is denied. ASP.NET is not authorized to access the requested resource. Consider granting access rights to the resource to the ASP.NET request identity. ASP.NET has a base process identity (typically {MACHINE}\ASPNET on IIS 5 or Network Service on IIS 6 and IIS 7, and the configured application pool identity on IIS 7.5) that is used if the application is not impersonating. If the application is impersonating via , the identity will be the anonymous user (typically IUSR_MACHINENAME) or the authenticated request user.

To grant ASP.NET access to a file, right-click the file in Explorer, choose "Properties" and select the Security tab. Click "Add" to add the appropriate user or group. Highlight the ASP.NET account, and check the boxes for the desired access.

我看着匿名訪問,但是這個應用程序的生產版本也有一個規則,禁止匿名訪問和它的正常工作。這個應用程序從來沒有使用模擬,即使它正在工作,我聽說通常不建議授予明確的ASP.NET訪問權限。我可以通過Visual Studio使應用程序在本地工作,但是部署到測試的版本會繼續出現此錯誤。我會認爲不要重新發布該網站來測試,但也許這是唯一的選擇嗎?有沒有什麼明顯的(但不是我),可以在安全設置中發生改變,導致這種情況?我仍然在研究沒有運氣。

謝謝!

+0

檢查您的應用程序池,設置運行的應用程序池是哪個用戶/標識? –

+0

身份被列爲「ApplicationPoolIdentity」 – ewomack

+0

「ApplicationPoolIdentity」是IIS 7.5不是7.在IIS 7.5中,每個應用程序池都具有唯一標識。在IIS7中,默認標識將是NetworkService。見http://stackoverflow.com/questions/4267941/iis-7-5-app-pool-identity-permission-not-assigned-to-folder-but-application-sti –

回答

2

您需要爲具有適當訪問級別的ApplicationPool身份提供服務帳戶。當您使用Studio時,它會使用您的用戶帳戶進行訪問,所以它幾乎是一個給定的。當應用程序安裝到IIS上時,它使用可用的最低級別的訪問,而這僅僅是不夠的。建議您不要將其廣泛打開,但爲此特定目的建立一個有限的訪問服務帳戶將允許應用程序運行,而無需損害系統或個人帳戶。

+1

謝謝,這是應用程序池標識缺少訪問權限。 – ewomack

相關問題