ASP .NET / VB .net Using Microsoft Interop Word - CreateObject(“Word.Application”) Crash

我是研究僧i 提交于 2020-01-16 09:14:09

问题


I'm just trying to fill a word dot file (using bookmark) with my asp net vb net webform site using Microsoft Interop Word.

It works perfectly in debug on my IIS Express, but crash on my Windows Server 2016 / IIS 10.

Dim oWord As Word.Application
oWord = CreateObject("Word.Application")

Server crash with message like this :

Cannot create ActiveX component. (original error message : Impossible de créer le composant ActiveX.)

I was searching for a fix, but a lot of post about this error are old.

I tried to check the server registry and the key {000209FF-0000-0000-C000-000000000046} is here with Microsoft Word Application as data.

On the server Microsoft Office 2016 is installed with Word.

Thanks you


回答1:


All versions of Microsoft Office were designed, tested, and configured to run as end-user products on a client workstation. They assume an interactive desktop and user profile. They do not provide the level of reentrancy or security that is necessary to meet the needs of server-side components that are designed to run unattended.

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.

You may consider using the Open XML SDK instead if you deal with open XML documents only. See Welcome to the Open XML SDK 2.5 for Office for more information.

Otherwise, you may use any third-party components designed for server-side execution (for example, Aspose).




回答2:


ASP.NET Cannot create ActiveX component

This link is actually what i'm searching for, but i don't have any Microsoft Word Application in my DCOM config.




回答3:


In most cases (by default), your local in-process web server (express) that launches from VS runs as a x32 bit web server. Your actual web server VERY likely runs as a x64 bit server. As a result, you need to install + use a x64 bit version of word. (you want to install office x64 on the server).

As noted, this tends to be a bad idea for web server code



来源:https://stackoverflow.com/questions/58391932/asp-net-vb-net-using-microsoft-interop-word-createobjectword-application

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