首页 新闻 会员 周边 捐助

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

0
[已解决问题] 解决于 2017-04-08 14:46

因为种种原因,需要调用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)

感觉是权限哪里出现问题了,但是又不知道怎么解决,

麻烦高手帮忙指点一下。

谢谢。

站在那看风景的主页 站在那看风景 | 菜鸟二级 | 园豆:371
提问于:2017-03-29 20:12
< >
分享
最佳答案
0

最后还是权限有问题,

自己解决办法参照如下:http://www.cnblogs.com/allenfly/p/6647164.html

站在那看风景 | 菜鸟二级 |园豆:371 | 2017-04-08 14:45
其他回答(1)
0

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

dudu | 园豆:30778 (高人七级) | 2017-03-29 21:13

按照您的方法给程序池指定账户结果和在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.

支持(0) 反对(0) 站在那看风景 | 园豆:371 (菜鸟二级) | 2017-03-29 21:48
清除回答草稿
   您需要登录以后才能回答,未注册用户请先注册