为了账号安全,请及时绑定邮箱和手机立即绑定

关于ASP.NET网站调用Outlook发送邮件失败的问题

关于ASP.NET网站调用Outlook发送邮件失败的问题

智慧大石 2018-12-06 19:44:29
因为种种原因,需要调用Server上的Outlook发送email, 现在的问题是当使用VS调试时是可以正常发送email, 但是一旦部署到IIS上,WEB端调用则会提示如下错误: 异常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)). at System.Runtime.Remoting.RemotingServices.AllocateUninitializedObject(RuntimeType objectType) at System.Runtime.Remoting.Activation.ActivationServices.CreateInstance(RuntimeType serverType) at System.Runtime.Remoting.Activation.ActivationServices.IsCurrentContextOK(RuntimeType serverType, Object[] props, Boolean bNewObj) at System.RuntimeTypeHandle.CreateInstance(RuntimeType type, Boolean publicOnly, Boolean noCheck, Boolean& canBeCached, RuntimeMethodHandleInternal& ctor, Boolean& bNeedSecurityCheck) at System.RuntimeType.CreateInstanceSlow(Boolean publicOnly, Boolean skipCheckThis, Boolean fillCache, StackCrawlMark& stackMark) at System.RuntimeType.CreateInstanceDefaultCtor(Boolean publicOnly, Boolean skipCheckThis, Boolean fillCache, StackCrawlMark& stackMark) at System.Activator.CreateInstance(Type type, Boolean nonPublic) at System.Activator.CreateInstance(Type type) 感觉是权限哪里出现问题了,但是又不知道怎么解决, 麻烦高手帮忙指点一下。 谢谢。
查看完整描述

3 回答

?
青春有我

TA贡献1784条经验 获得超8个赞

给IIS的应用程序池指定一个帐户试试

查看完整回答
反对 回复 2019-01-21
?
慕森王

TA贡献1777条经验 获得超3个赞

按照您的方法给程序池指定账户结果和在web.config里节点<system.web>添加

<identity impersonate="true" userName="accountname" password="password" />

后的执行结果一样,

提示

异常System.Runtime.InteropServices.COMException (0x80040111): Cannot create the e-mail message because a data file to send and receive messages cannot be found. Check your settings in this Microsoft Outlook profile. In Microsoft Windows, click the Start button, and then click Control Panel. Click User Accounts, and then click Mail.  Click Show Profiles, select this profile, and then click Properties. The server is not available. Contact your administrator if this condition persists.

查看完整回答
反对 回复 2019-01-21
  • 3 回答
  • 0 关注
  • 773 浏览

添加回答

举报

0/150
提交
取消
意见反馈 帮助中心 APP下载
官方微信