2011-09-16 167 views
3

我的Windows 7上有我的IIS 7.0的奇怪和無法解決的問題。
我盡我的本地測試服務器上運行的網站,並獲得以下錯誤:IIS 7:身份'IIS APPPOOL DefaultAppPool'沒有足夠的權限來訪問臨時目錄

Access to the temp directory is denied. 
Identity 'IIS APPPOOL\DefaultAppPool' under 
which XmlSerializer is running does not have sufficient permission 
to access the temp directory. 

CodeDom will use the user account the process is using to do the compilation, 
so if the user doesn't have access to system temp directory, 
you will not be able to compile. 
Use Path.GetTempPath() API to find out the temp directory location. 

我有幾個游泳池,但其中只有一個工作正常。它是Classic .NET AppPool。在其他人的網站上運行我得到錯誤,這是前面提供的。最令人興奮的是我無法通過IIS管理器的應用程序池找到池之間的任何配置差異。也許我錯過了什麼?
我試圖更改Windows\TempC:\Windows\Microsoft.NET\Framework\v4.0.30319\Temporary ASP.NET Fileslocal settings' temporary folder的訪問權限,但我的操作沒有效果。

因此,希望您的幫助和一些建議。

回答

2

您是否撥打了Path.GetTempPath()方法(您可以從每個程序中調用此方法,而不必從您的網站中調用此方法)?

您必須爲您的帳戶設置對此路徑的完全訪問權限。

而且我發現this forum topic

Another reason could be that the processModel in machine.config is set so that ASP.Net is running inside dllhost.exe instead of aspnet_wp.exe. If this is the case then you would need to give rights to IWAM_machineName account as well.

You can check the name of the process and account under with access denied error occurs by using FileMon utility from sysinternals.com.

0

另外一個值得考慮的選擇...的默認應用的「C:\用戶」下創建自己的用戶帳戶和文件夾的創建和首輪池時目錄。它實際上是一個虛擬用戶帳戶,應該爲應用程序池或「DefaultAppPool」命名。它使用此臨時用戶帳戶來運行該池。在某些設置中,當訪問IIs網站並使用默認池時,用戶不會看到此文件夾,而是一個TEMP文件夾。此用戶文件夾由池和ASP.NET用於緩存和寫入II,ASP.NET和此虛擬帳戶使用的文件資源和其他內容。

如果您在Users文件夾中看到「TEMP」文件夾,您在IIs和註冊表中的應用程序池帳戶已損壞。池正在創建TEMP文件夾作爲此虛擬帳戶的備份,該虛擬帳戶可能沒有正確的安全設置。我有這個確切的場景。

要修復它去到註冊表中: HKEY_LOCAL_MACHINE \ SOFTWARE \微軟\的Windows NT \ CURRENTVERSION \ ProfileList文件 查看是否有與名爲「.bak」擴展爲默認應用用戶帳戶的SID的用戶帳戶。如果這樣刪除並重新啓動您的電腦。再次測試您的網站,確保其實際設置爲使用DefaultAppPool。它現在應該重新創建用戶中的「DefaultAppPool」文件夾,重新創建DefaultAppPool用戶的註冊表項,並且您的錯誤應該消失。即沒有TEMP文件夾。

當我這樣做後,我的所有堆棧溢出錯誤都在Visual Studio中爲我的Web應用程序消失了,並且所有的應用程序池在IIs中重新啓動並最終崩潰。

相關問題