我已閱讀其他職位關於如何做到這一點,但無濟於事。當我部署我的應用程序服務器(2008年)我得到以下異常在運行時:如何將我的ASP.NET MVC應用程序讀取權限授予註冊表項?
Access to the registry key 'HKEY_CURRENT_USER\Software\Microsoft\VisualStudio\9.0\TeamFoundation\Servers' is denied.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.UnauthorizedAccessException: Access to the registry key 'HKEY_CURRENT_USER\Software\Microsoft\VisualStudio\9.0\TeamFoundation\Servers' 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) that is used if the application is not impersonating. If the application is impersonating via <identity impersonate="true"/>, the identity will be the anonymous user (typically IUSR_MACHINENAME) or the authenticated request user.
授予ASP.NET對文件的訪問,請右鍵單擊資源管理器中,選擇「屬性」,然後選擇安全選項卡。點擊「添加」添加適當的用戶或組。突出顯示ASP.NET帳戶,然後選中所需訪問權限的複選框。
所以這個錯誤看起來很具描述性。我打開註冊表編輯器並右鍵單擊KEY(HKEY_CURRENT_USER \ Software \ Microsoft) - > Permissions - >添加用戶'NETWORK SERIVCE'並授予完全控制權。
我認爲這是ASP.NET運行以訪問註冊表的用戶。
然後我試圖禁用'包含此對象的父對象的可繼承權限。
這也沒有工作。
從IIS管理器中,在我的應用程序的身份驗證設置下,我將「匿名身份驗證」用戶設置爲管理員組中的我自己的用戶。
似乎沒有任何工作。
我該如何解決這個問題?這是一個在我們的本地網絡上運行的內部工具,所以在這個階段我不太關心安全權限。我怎樣才能授予適當的權限?
謝謝!
如果您將匿名用戶設置爲除NETWORK SERVICE以外的其他用戶,則應該授予該用戶對註冊表的訪問權限。 – casperOne 2010-12-03 21:08:13