System.Runtime.InteropServices.COMException (0x800A1436)

浪尽此生 提交于 2019-12-08 09:36:57

问题


We are trying to open a Word template which resides on a Shared Drive using Office Interop Services on an MVC application.The solution is working locally, but once is deployed to the server the following message appears:

The File was not created: System.Runtime.InteropServices.COMException (0x800A1436): This file could not be found

ApplicationPool is running under a domain user account which already has permissions on the shared drive.

Any suggestion?


回答1:


You may consider using the Open XML SDK for dealing with open XML documents (.docx), see Welcome to the Open XML SDK 2.5 for Office. Or any other third-party components designed for the server-sider execution (for example, Aspose).

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.

If you are building a solution that runs in a server-side context, you should try to use components that have been made safe for unattended execution. Or, you should try to find alternatives that allow at least part of the code to run client-side. If you use an Office application from a server-side solution, the application will lack many of the necessary capabilities to run successfully. Additionally, you will be taking risks with the stability of your overall solution. Read more about that in the Considerations for server-side Automation of Office article.




回答2:


Kb257757 https://support.microsoft.com/en-us/help/257757/considerations-for-server-side-automation-of-office

Server-side automation of office is not supported using Interop, try using an XML based approach such as ClosedXML which is available from NuGet.



来源:https://stackoverflow.com/questions/43644441/system-runtime-interopservices-comexception-0x800a1436

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!