Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Excel cannot access the file with IIS7&Windows Server 2008 R2 (64bit)

I have a web project (.NET 4) that needs to access an Excel file, but it ends up with the following error message:

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.

In IIS7, I use DefaultAppPool with the identity "myservice" who is under the group of Administrators.

In the authentication page of my website under IIS, anonymous authentication was enabled and set to "Application pool identity" and ASP.NET impersonation was disabled.

After searching the solution for hours, I found the following but none of them work

  1. Create folder in C:\Windows\SysWOW64\config\systemprofile\Desktop. Please refer:this
  2. Grant rights of "myservice" in Component Services. Please refer:this

One thing strange, there is nothing in the Group of IIS_IUSRS. Is that normal? I remember at least two users (DefaultAppPool & Classic .NET AppPool).

I assume that is a permission problem of IIS, but I can not solve it.

like image 991
macemers Avatar asked Dec 20 '22 20:12

macemers


1 Answers

Problem solved!!!!!!!!!! My Excel is 2010 , should create "Desktop" folder in C:\Windows\System32\config\systemprofile

like image 164
macemers Avatar answered Dec 28 '22 08:12

macemers