我有一个问题,起初似乎是许可。 在本地主机上工作正常,但是当转到服务器时发生错误:
[UnauthorizedAccessException: Retrieving the COM class factory for component with CLSID {000209FF-0000-0000-C000-000000000046} failed due to the Following error: 80070005.]
我用的是IIS7
我给了 iis 用户权限但无济于事,然后我在代码中传播“try catch”,发现错误与它尝试创建 Microsoft.Office.Interop.Word 实例的那一刻有关
例子
using Word = Microsoft.Office.Interop.Word;
private bool Exemple(SqlDataReader dbReader, string strFilePath)
{
Word.Application oApp = new Word.Application (); // error here
...
...
...
}
Microsoft.Office.Interop.Word 服务器的 Bin 文件夹中的这个 dll,有人知道会发生什么吗?
谢谢。
请您参考如下方法:
虽然您不应在服务器上使用 Office 互操作库。 Microsoft 不推荐或支持这种实现方式,但如果您乞求惩罚以克服您的错误,您需要在服务器上打开 DCOM 配置并将身份设置为您的应用程序池正在运行的用户并授予他们访问启动和激活权限。同样,您不想在服务器上设置 Office 互操作库。
