title: Excel cannot access the file with IIS7&Windows Server 2008 R2 (64bit)
body: <p>I have a web project (.NET 4) that needs to access an Excel file, but it ends up with the following error message:</p>
  
  <pre><code>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.
  </code></pre>
  
  <p>In IIS7, I use DefaultAppPool with the identity "myservice" who is under the group of Administrators. </p>
  
  <p>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.</p>
  
  <p>After searching the solution for hours, I found the following but <em>none</em> of them work</p>
  
  <ol>
  <li>Create folder in C:\Windows\SysWOW64\config\systemprofile\Desktop. Please refer:<a href="http://social.msdn.microsoft.com/Forums/en-US/innovateonoffice/thread/b81a3c4e-62db-488b-af06-44421818ef91?prof=required" rel="nofollow">this</a></li>
  <li>Grant rights of "myservice" in Component Services. Please refer:<a href="http://blog.crowe.co.nz/archive/2006/03/02/589.aspx" rel="nofollow">this</a></li>
  </ol>
  
  <p>One thing strange, there is nothing in the Group of IIS_IUSRS. Is that normal?  I remember at least two users (DefaultAppPool &amp; Classic .NET AppPool).</p>
  
  <p>I assume that is a permission problem of IIS, but I can not solve it.</p>