如何将COM对象Microsoft.Office.Interop部署到IIS,以便我的C#WCF服务引用可以工作? [英] How to deploy COM object Microsoft.Office.Interop to IIS so that my C# WCF service reference will work?

查看:542
本文介绍了如何将COM对象Microsoft.Office.Interop部署到IIS,以便我的C#WCF服务引用可以工作?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我尝试从本地计算机上的IIS 7运行我的Web应用程序时收到有关Microsoft.Office.Interop.Outlook的错误,如下所示...

I am getting an error when trying to run my web application from IIS 7 on my local machine regarding Microsoft.Office.Interop.Outlook that is like the following...

由于以下错误,检索CLSID为{0006F03A-0000-0000-C000-000000000046}的组件的COM类工厂失败:80070005拒绝访问。 (来自HRESULT的异常:0x80070005(E_ACCESSDENIED))。

Retrieving the COM class factory for component with CLSID {0006F03A-0000-0000-C000-000000000046} failed due to the following error: 80070005 Access is denied. (Exception from HRESULT: 0x80070005 (E_ACCESSDENIED)).

当我从VS2010和Cassini运行这个相同的网络应用时我没有问题。

When I run this same web app from VS2010 and Cassini I have no problem.

当我运行来自IIS 7的Web应用程序我将我的VS2010指向IIS虚拟目录。
实际上我甚至让VS2010创建了虚拟目录。所以我能够从VS2010调试并收集我在这里发布的错误。

When I run the web app from IIS 7 I point my VS2010 at the IIS Virtual Directory. In fact I even had VS2010 create the Virtual Directory. So I am able to debug from VS2010 and gather the error I posted here.

我已经转到了Microsoft.Office.Interop.Outlook.dll文件并且给了每个人阅读,编写,修改和删除。只是为了排除安全性。

I have gone to the Microsoft.Office.Interop.Outlook.dll file and given EVERYONE read,write,modify, and delete. Just to rule out security.

引用Microsoft.Office.Interop dll时还有其他步骤吗?我应该以不同的方式配置有关此事再次切换回在Cassini中运行并没有问题。

Are there other steps when referencing Microsoft.Office.Interop dlls? Should I configure something regarding this differently. Again switch back to running in Cassini and no problems.

推荐答案

在我的服务器上安装SharePoint并在网络服务帐户下运行。这将是一个隐藏的帐户,通常不允许运行COM对象。如果您进入IIS并查看它正在使用哪个应用程序池(在高级设置下)。然后检查该池的标识。一位朋友建议我们在指定帐户(如[domain] \svcSharepoint)下运行我们的SharePoint应用程序池(和其他服务),以便您可以明确授予权限。否则,网络服务帐户将显示为[域名] [机器名称] $(请注意最后的$,表示隐藏帐户)。

On my server SharePoint is installed and running under the account "Network Service". That would be a hidden account, that normally would not be allowed to run COM objects. If you go into IIS and see which App Pool it is using (under Advanced Settings). Then check the Identity of that pool. A friend had recommended that we run our SharePoint app pool (and other services) under a named account (like [domain]\svcSharepoint) so you can explicitly give permission. Otherwise, the Network Service account would show up as [domain][machine name]$ (note the $ at the end, meaning "hidden account").

另一个如果你在Server 2008 R2上安装了这个因素,因为UAC的东西要强得多,并且肯定会拒绝这种交互。关闭UAC有点风险,但可能会成为赢家。

One other factor would be if you installed this on Server 2008 R2, because the UAC stuff is much stronger and would deny this kind of interaction for sure. Turning off the UAC is a little risky, but could be a winner.

最后一个因素是检查该COM对象的DCOM配置。 [开始菜单,管理员工具] [组件服务] [DCOM配置]。按名称或GUID,Properites,安全性查找Outlook。

Last factor would be checking the DCOM configs for that COM object. [Start Menu, Administrator Tools][Component Services][DCOM Config]. Find Outlook by name or by GUID, Properites, Security.

这篇关于如何将COM对象Microsoft.Office.Interop部署到IIS,以便我的C#WCF服务引用可以工作?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆