zoukankan      html  css  js  c++  java
  • 关于ASP.NET Web端调用Server上Outlook发邮件,VS调试正常,但部署至IIS则失败的问题

    最近由于种种原因,有一个需求即在ASP.NET网站里调用Server上的Outlook发送邮件。

    在本地测试时,使用的IISExpress,发送email正常。

    后来发布到我本地的IIS上,则会出现80070005 的错误。

    初步怀疑是权限的问题,还在园子里发过如下地址的求助。

    https://q.cnblogs.com/q/92129/

    可惜行不通。

    后来在CSDN看到一篇文章去修改DCOM配置。

    http://blog.csdn.net/tony0225/article/details/18349443

    1. In DCOMCNFG, right click on the My Computer and select properties. 
    2. Choose the COM Securities tab
    3. In Access Permissions, click "Edit Defaults" and add Network Service to it and give it "Allow local access" permission. Do the same for \Users.
    4. In launch and Activation Permissions, click "Edit Defaults" and add Network Service to it and give it "Local launch" and "Local Activation" permission. Do the same for \Users

    在我的本地,32位win7英文系统,Start->Control Panel->Administrative Tools->Component Services->Component Services->Computers->My Computer->DCOM Config

    修改Microsoft Outlook、Microsoft Outlook Command Button Control、Outlook Message Attachment、otkloadr 这四个选项(有的电脑可能会没有Microsoft Outlook、otkloadr这两个,有可能是因为outlook升级多版本等等原因 )

    这四个选项里的属性(右键选择propeties),Security里Access Permissions、launch and Activation Permissions 选项里添加everyone、Anonymous Logon(不放心甚至可添加Network Service 、IIS_Users等用户)

    并将权限赋全。

    另外在Identity选项中选择交互用户 the interactive user.

    另外还有一点,IIS应用池里对应的那个应用池的高级设置里(Advanced Settings...) 将process model 的Identity  设置为最高权限(我这边为Local service,后来还遇到一个坑)

    终于可以正常调用outlook发送email了。

    但是后来又发布到另外一台机器上时,又遇到坑了。

    该机器为64位企业版win7,参照上述步骤设置后,还是提示各种{0006F03A-0000-0000-C000-000000000046} fail的错误。

    后来又将上面的IIS应用池的Identity设置为LocalSystem则ok了。

    哎...

    另外因为office是32位的,所以设置DCOM时需要用 comexp.msc -32 命令打开设定界面。

    下面的异常是这次部署过程中的一些异常提示信息。

    System.UnauthorizedAccessException: 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)).

    System.Runtime.InteropServices.COMException (0x80080005): Retrieving the COM class factory for component with CLSID {0006F03A-0000-0000-C000-000000000046} failed due to the following error: 80080005 Server execution failed (Exception from HRESULT: 0x80080005 (CO_E_SERVER_EXEC_FAILURE))

  • 相关阅读:
    K2新网站(官网和BPM社区)正式上线了
    在线体验K2 BPM微信审批
    K2 BPM + SAP,实现全方面管理企业
    KStar ----BPM应用框架,K2 的新星
    SharePoint加K2,将Portal系统与BPM系统完美整合!
    迈瑞综合应用及流程管理平台项目
    深度学习教程网站
    Pytorch自定义参数层
    pytorch BCELoss和BCEWithLogitsLoss
    Some helper functions for PyTorch
  • 原文地址:https://www.cnblogs.com/allenfly/p/6647164.html
Copyright © 2011-2022 走看看