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))

  • 相关阅读:
    【原】更改ubuntu15.04的开机启动等待时间和启动项
    【转载】中文ubuntu里用户目录里的路径改成英文
    Ubuntu 14.04安装Chromium浏览器并添加Flash插件Pepper Flash Player
    如何直接从 Google Play 下载 APK 文件?
    Android Studio 1.1.0 最新版的安装和配置篇(Windows篇)【最新版】
    【更新到第10周】杭州电子科技大学计算机学院C#课程作业合集参考和下载
    华为P7拆机换屏图片教程
    网赚72变-桌面教程+引流技术分享
    Tomcat 8080爆破多线程
    微速摄影教学之系列视频+摄影技术
  • 原文地址:https://www.cnblogs.com/allenfly/p/6647164.html
Copyright © 2011-2022 走看看