Microsoft Word的COM组件错误 [英] COM Component Error for Microsoft Word
问题描述
我正在尝试使用asp.net中的c#将.doc文件转换为.docx文件。它通过Visual Studio 2010正常工作。但是在IIS中托管应用程序后它无法正常工作。它没有将.doc文件转换为.docx文件。我检查了日志文件。我收到以下错误消息
检索具有CLSID {000209FF-0000-0000-C000-000000000046}的组件的COM类工厂由于以下错误而失败:80070005访问被拒绝。 (HRESULT异常:0x80070005(E_ACCESSDENIED))。
请帮我解决这个问题。
先谢谢你
I am trying to convert the .doc file to .docx file using c# in asp.net. It is working fine through Visual Studio 2010. But after hosting the application in IIS it is not working. It is not converting the .doc file to .docx file. I checked in the Log file. I got the following error message
Retrieving the COM class factory for component with CLSID {000209FF-0000-0000-C000-000000000046} failed due to the following error: 80070005 Access is denied. (Exception from HRESULT: 0x80070005 (E_ACCESSDENIED)).
Please help me to resolve this issue.
Thanks in Advance
推荐答案
您的问题是您正在尝试从IIS访问Word COM API。这不是一个好习惯。它使桌面应用程序Microsoft Word出现在您的生产服务器上。为什么它应该在地球上呢?从服务器端代码调用桌面应用程序并不好。当然IIS禁止这样的东西。
相反,你应该找到一个不依赖于COM API的库。一个很好的(虽然付费)是由 Aspose 制作的,特别是你感兴趣的在 Aspose.Words for .NET 中。我在ASP.NET项目中使用它。您可以尝试找到一些免费的库。
Your problem is that you're trying to access the Word COM API from IIS. That is not a good practice. It makes desktop application Microsoft Word be present on your production server. Why on Earth should it be there? It's not good at all to call a desktop application from the server side code. Of course IIS forbids such stuff.
Instead you should find a library which doesn't depend on COM API. A good one (paid though) is the one made by Aspose, in particular, you're interested in Aspose.Words for .NET. I worked with it in an ASP.NET project. You can try to find some free libraries around.
这篇关于Microsoft Word的COM组件错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!