Microsoft Office Excel cannot access the file 'c:\inetpub\wwwroot\Timesheet\App_Data\Template.xlsx'

前端 未结 7 1582
死守一世寂寞
死守一世寂寞 2020-11-27 12:35

I have my code as follows :-

Microsoft.Office.Interop.Excel.Application oXL = null;
Microsoft.Office.Interop.Excel.Sheets sheets;
Application excel = new Mic         


        
7条回答
  •  -上瘾入骨i
    2020-11-27 13:32

    I've wrapped my WCF in a Windows Service. Creating the Desktop Folders did solve it for me on one machine, but not on another.

    My problem in the end was, that my Windows Service did not run under an active User of the machine. Configuring the service to run under a user which is active on the machine solved this problem for me so far.

    Only the combination of

    • Existing Desktop Folder
    • Service running under a real user Account

    got it working for me.

    This article lead me to the full solution: Cannot access excel file

提交回复
热议问题