COMException (0x800A13E9) - Word interop services

后端 未结 4 1487
北恋
北恋 2021-01-05 01:59

I am getting this stacktrace:

System.Runtime.InteropServices.COMException (0x800A13E9): Word ðú÷ì ááòéä.
   at Microsoft.Office.Interop.Word.Documents.Add(         


        
相关标签:
4条回答
  • 2021-01-05 02:09

    Here's the solution I found:

    1. Put a folder called Desktop on C:\Windows\SysWOW64\config\systemprofile (Yes I know. WTF?)
    2. Open Regedit, Go to HKEY_LOCAL_MACHINE\SOFTWARE\Classes\AppId and edit the two enteries that have a Guid ending with 46. Delete every key they have and add a new key called RunAs with the value of Interactive User

    After that, start praying. It doesn't work if you access through a terminal server. Which is kind of a problem for me hehe.

    EDIT: The problem with the terminal server was that only an Administrator is allowed to raise COM objects so what you have to do is impersonate to an Administrator.

    0 讨论(0)
  • 2021-01-05 02:10

    Update Microsoft has fixed the issue with an update.
    For all who have the issue with the regional format please update your Office to the Version 1902 (Build 11328.20158).
    You might need to change to the monthly update channel to get it.

    For Windows 10 1809 users the issue might come from the windows regional format settings. It seems that there is an issue when you use a special regional format like "English (Switzerland)". If you change it to "English (UK)" everything works fine. The information about this I have found here

    Hope this helps someone who still face the issue.

    0 讨论(0)
  • 2021-01-05 02:11

    Sorry 'bout that 1MB reference... I just had to jump on that one.

    When automating Office Applications make sure, that you use a local account on the server with permissions for the Word COM+ object as well as the documents you are trying to work on.
    There are several posts relating to your problem pointing at the account issue:

    • ASP.NET 1.1 + 2003 Server + open Word document = InteropServices.COMException(0x800A13E9)
      • suggests that you should use an "interactive user" instead of the "launching user"
    • Error while calling MS-Word from ASP.NET
      • suggests creating a local user granting all permissions for the Word COM+ object
    0 讨论(0)
  • 2021-01-05 02:27

    Your scenario is NOT supported by Microsoft according to the KB article Considerations for server-side Automation of Office which states that

    Microsoft does not currently recommend, and does not support, Automation of Microsoft Office applications from any unattended, non-interactive client application or component (including ASP, ASP.NET, DCOM, and NT Services), because Office may exhibit unstable behavior and/or deadlock when Office is run in this environment.

    The article then goes over alternatives to server-side automation one of which is Open XML. You might want to check this article out if you haven't already done so.

    0 讨论(0)
提交回复
热议问题