Thursday, June 9, 2016

System.Runtime.InteropServices.COMException (0x800A03EC): Microsoft Office Excel cannot access the file

On some versions of Windows Server, you might see this error when trying to access office file. And from here, the solution is extremely easy (and weird).

  1. Create directory "C:\Windows\SysWOW64\config\systemprofile\Desktop " (for 64 bit Windows) or "C:\Windows\System32\config\systemprofile\Desktop " (for 32 bit Windows)

# for 64 bit Windows
    New-item -ItemType Directory -Force -Path "C:\Windows\SysWOW64\config\systemprofile\Desktop"

# for 32 bit Windows
    New-item -ItemType Directory -Force -Path "C:\Windows\System32\config\systemprofile\Desktop"

  1. Set Full control permissions for directory Desktop (for example in Win7 & IIS 7 & DefaultAppPool set permissions for user
    "IIS AppPool\DefaultAppPool")