Is Microsoft.Office.Interop safe to use for (file-converting) for a website?

一世执手 提交于 2019-12-01 23:26:34
dash

The answer, from Microsoft, is no:

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.

From Considerations for Server-Side Automation of Office

From experience, here are the issues we encountered:

  • When the process exists unexpectedly, lots of Word instances are left around, and are never cleaned up
  • The Word installation became corrupt after a shutdown occurred half-way through a processing session
  • It doesn't scale remarkably well - Word is a large desktop application that is excellent at what it does; however, it's not really meant for the process you are using it for, and, as such, opening lots of instances of it will consume resources that your application could use.

There are other ways to do this, however, as covered in this StackOverflow question and answers

You may consider pre-converting the word documents - for example, is it possible, when the document is uploaded, to also create the PDF then? That way, your server is simply serving up a PDF document and has to do very little work in servicing the request.

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