Word中互操作时IIS中运行未经授权的例外

问题描述:

我有一个pretty讨厌的问题。我写了做一个纲领性的邮件合并使用Office.word.interop(Microsoft.Office.Interop.Word.dll)客户的应用程序。一切正常。然后,客户从网站中希望相同的功能,一切都开始走下坡路。我包含在一个网站我的code,一切都在调试模式下工作,但是当我发表,并在IIS下跑我不断收到错误:

I have a pretty nasty problem. I wrote an application which does a programmatic mail merge for a customer using the Office.word.interop (Microsoft.Office.Interop.Word.dll). Everything worked fine. Then the customer wanted the same functionality from within a website and everything went downhill. I included my code in a website and everything worked in debug mode but when I published it and ran under IIS I keep getting the error:

与CLSID检索COM类工厂组件
  {000209FF-0000-0000-C000-000000000046}失败,原因是以下
  错误:80070005

Retrieving the COM class factory for component with CLSID {000209FF-0000-0000-C000-000000000046} failed due to the following error: 80070005.

当我Google这个我一直得到建议使用组件服务更改安全设置以包括IIS用户。在我的2003服务器我给了pretty每多有权限是pretty很多大家,但没有得到结果。在我的Windows 7盒,我不能即使没有'走的是注册表项控制编辑安全。这并不甚至似乎是值得研究的。

When I Googled this I kept getting advice to use component services to change the Security setting to include the IIS user. On my 2003 Server I gave pretty much every permission there is to pretty much everybody but got no results. On my Windows 7 box I can't even edit the security without 'taking control of the registry key'. Which does not even seem to be worth looking into.

有没有希望?

我不相信办公室是一个Web服务器上使用线程安全的(甚至行货) - 即使你得到了它在一个时间为单个用户工作,我怀疑你会得到无故障运行,一旦你缩放它多个并发用户。

I dont believe Office is thread safe (or even licensed) for use on a web server - even if you got it to work for a single user at a time, I doubt you would get trouble-free operation once you scaled it to multiple concurrent users.

检查您对您的Microsoft Office包EULA,你会发现它是不许可用于该用途的(或者是特别不支持该useage)。有服务器端的文件组成的商业.NET库,我建议您使用这些特定目的建造者之一,而不是试图做办公室互操作(这在任何情况下,很慢)。

Check your EULA on your Microsoft Office pack, you might find it is not licensed for this use (or this useage is specifically not supported). There are commercial .net libraries for server side document composition, and I recommend you use one of these purpose built ones rather than trying to do Office Interop (which in any case is very slow).