Unhandled Exception: System.Runtime.InteropService

2020-02-28 09:56发布

I have a C# application that exports an Excel file. When I run it from Visual Studio, it is working fine. However, when I schedule it to run from SQL Server Agent, it failed with the following error:

Unhandled Exception: System.Runtime.InteropServices.COMException (0x800A03EC): Microsoft Office Excel cannot open or save any more documents because there is not enough available memory or disk space. To make more memory available, close workbooks or programs you no longer need. To free disk space, delete files you no longer need from the disk you are saving to.

I have searched many links, and they say it could be a permission issue. So I applied the things below per the solutions provided in Stack Overflow, but no luck.

  1. Created directory “C:\Windows\SysWOW64\config\systemprofile\Desktop ” (for 64 bit Windows)

  2. Applied Full control permissions for directory Desktop for my domain user, SQLServiceAgent

I'm using SQL Server 2014 and Win 2012 Edition with MS Excel 2007.

Can anyone help?

1条回答
等我变得足够好
2楼-- · 2020-02-28 10:21

I tried this and it worked. I found "Microsoft Excel Application" is missing in DCOM Config. So, I did the following steps:

  1. Start
  2. Run
  3. mmc -32
  4. File
  5. Add Remove Snap-in
  6. Component Services
  7. Add
  8. OK
  9. Console Root
  10. Component Services
  11. Computers
  12. My Computer
  13. DCOM Config
  14. Microsoft Excel Application -> Right click -> Properties
  15. On Security tab, give full permissions to the domain user and NT SERVICE\SQLSERVERAGENT on: a. Launch and Active Permissions b. Access Permissions c. Configuration Permissions
  16. On Identiy tab -> change to Interactive User

That's it. I ran the SQL job and it succeeded.

查看更多
登录 后发表回答