2012-06-21 93 views
4

我有一個web項目(.NET 4)需要訪問Excel文件訪問該文件,但它與以下錯誤消息結束了:Excel不能用IIS7和Windows Server 2008 R2的(64位)

Error occurred during file generation.Microsoft Excel cannot access the file 'D:\xx\xx\abc.xls'. 
There are several possible reasons: 
• The file name or path does not exist. (Actually it is there) 
• The file is being used by another program. (It can not happen) 
• The workbook you are trying to save has the same name as a currently open workbook. 

在IIS7中,我使用屬於管理員組的「myservice」身份的DefaultAppPool。

在IIS下的我的網站的身份驗證頁面中,啓用了匿名身份驗證並將其設置爲「應用程序池標識」,並禁用了ASP.NET模擬。

搜索小時的解決方案後,我發現以下,但他們沒有工作

  1. 在C上創建文件夾:\ WINDOWS \ Syswow64資料\ CONFIG \ systemprofile \桌面。請參閱:this
  2. 在組件服務中授予「myservice」權限。請參考:this

有一點很奇怪,IIS_IUSRS組中沒有任何東西。這是正常的嗎?我記得至少有兩個用戶(DefaultAppPool & Classic .NET AppPool)。

我認爲這是IIS的權限問題,但我無法解決它。

+0

指定的目錄是否存在?管理員組是否具有對該目錄的讀,寫,創建等權限? – sarnold

+0

答案是肯定的。 – DerekY

+0

您沒有提及安裝的Excel的版本和位數。 –

回答

11

問題解決!!!!!!!!!!我的Excel是2010,應該在C:\ Windows \ System32 \ config \ systemprofile中創建「桌面」文件夾

+0

謝謝。我與SharePoint 2010 WebPart自動化Excel服務器端存在完全相同的問題。這讓我非常沮喪地爲我+1了。 – Andez

相關問題