Office automation (Interop) on Windows Server 2012

安稳与你 提交于 2019-11-28 11:47:23

I'll probably get downvoted for this answer, but I work in an enterprise environment where we have a product that uses Office Automation, and it is very problematic.

I've done research in this arena, and Microsoft itself recommends against doing Office Automation.

The following is directly from Microsoft's MSDN knowledge base

Microsoft does not recommend or support server-side Automation of Office.

Also

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.

Source: http://support.microsoft.com/kb/257757

The only solution found is to make the process that invokes Office API to run as interactive. It can be done by just running a console app (not the brightest idea for server solutions) or by creating some background service (e.g., windows service) and set it's station (SetProcessWindowStation).

One of the reason to see that error message is if server is missing SysWow64 folder. Here a link that might help you understand better.

http://per.lausten.dk/blog/2011/04/excel-automation-on-windows-server-2008-x64.html

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