在iis 7.5中通过ms outlook为已部署项目发送电子邮件时出错 [英] Error on sending email through ms outlook for deployed project in iis 7.5

查看:125
本文介绍了在iis 7.5中通过ms outlook为已部署项目发送电子邮件时出错的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在IIS 7.5上部署了我的项目。但是通过MS Outlook发送电子邮件时出错

检索具有CLSID {0006F03A-0000-0000-C000-000000000046}的组件的COM类工厂失败,原因如下错误:80070005访问被拒绝。 (HRESULT异常:0x80070005(E_ACCESSDENIED))



下面的相关代码

  public   void  SendEmailthroughOutlook( string  emailAddressTo, string  sSubject, string  sText){
Application app = new 申请(); // 实现此行时出错
NameSpace ns = app.GetNamespace( mapi);
// ns.Logon(Email-Id,Password,false,true);
MailItem message =(MailItem)app.CreateItem(OlItemType.olMailItem);
message.To = emailAddressTo;
message.CC = ;
sSubject = 主题: + sSubject;
message.Subject = sSubject;
message.Body = sText;

message.Send();
ns.Logoff();
}



我也提到了 asp.net - & quot;检索组件的COM类工厂....错误:80070005访问被拒绝。& quot; (来自HRESULT的异常:0x80070005(E_ACCESSDENIED)) - 堆栈溢出 [ ^ ]并检查了DCOM配置树,但我没有看到任何MS Office组件。

这个问题的正确解决方案是什么?谢谢。



我的尝试:



VS2010调试成功,但在IIS中部署失败

解决方案

您无法使用Outlook从WebServer发送电子邮件。首先,您必须在服务器上安装Office,但不要打扰这样做。由于Office应用程序不同时支持多个请求,因此服务器(非交互)环境中不支持任何Office应用程序。 Web服务器就是一个例子。



你为什么不使用内置的邮件类 [ ^ ]在.NET Framework中发送电子邮件?


< blockquote> 访问被拒绝



您的应用程序无权访问资源。确保您的程序支持导航和访问目录中的资源。由于您在谈论IIS,请在IIS论坛上阅读此主题:访问被拒绝。 (HRESULT异常:0x80070005(E_ACCESSDENIED)):官方Microsoft IIS论坛 [ ^ ],表示您需要为程序提供管理员权限。



访问被拒绝。 (来自HRESULT的异常:0x80070005(E_ACCESSDENIED))在vb.net [ ^ ]

c# - 拒绝访问。 (来自HRESULT的异常:0x80070005(E_ACCESSDENIED) - 堆栈溢出 [ ^ ]



无论如何,如果你在第三方提供的托管环境中派对公司。然后你必须与他们的代表沟通,并要求他们允许你的申请使用资源; 提供访问


I deployed my project on IIS 7.5. But got error on sending email through MS Outlook

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


The related code below

public void SendEmailthroughOutlook(string emailAddressTo, string sSubject, string sText) {
    Application app = new Application();  // Error when implement this line
    NameSpace ns = app.GetNamespace("mapi");
    //ns.Logon("Email-Id", "Password", false, true);
    MailItem message = (MailItem)app.CreateItem(OlItemType.olMailItem);
    message.To = emailAddressTo;
    message.CC = "";
    sSubject = "Subject: " + sSubject;
    message.Subject = sSubject;
    message.Body = sText;

    message.Send();
    ns.Logoff();
}


I also referred to asp.net - &quot;Retrieving the COM class factory for component.... error: 80070005 Access is denied.&quot; (Exception from HRESULT: 0x80070005 (E_ACCESSDENIED)) - Stack Overflow[^] and checked the DCOM Config tree, but I did not see any MS Office component there.
What's the proper solution for this problem? Thanks.

What I have tried:

Successful in VS2010 debugging, but failed as deployed in IIS

解决方案

You can't use Outlook to send an email from a WebServer. First, you have to have Office installed on the server, but don't bother doing this. None of the Office applications are supported in a server (non-interactive) environment as Office applications do not support multiple requests at the same time. A web server is an example of this.

Why are you not using the built in mail classes[^] in the .NET Framework to send an email?


Access is denied.

Your application does not have access to the resources. Make sure, your program is supported to navigate and access the resources in the directory. Since you are talking about IIS, read this thread on IIS forums: Access is denied. (Exception from HRESULT: 0x80070005 (E_ACCESSDENIED)) : The Official Microsoft IIS Forums[^], which says, you need to provide Administrator privileges to the programs.

Access is denied. (Exception from HRESULT: 0x80070005 (E_ACCESSDENIED)) in vb.net[^]
c# - Access is denied. (Exception from HRESULT: 0x80070005 (E_ACCESSDENIED) - Stack Overflow[^]

Anyhow, if you are on a hosting environment provided by a third-party company. Then you would have to communicate with their representative and ask them to allow your application to use the resources; provide the access.


这篇关于在iis 7.5中通过ms outlook为已部署项目发送电子邮件时出错的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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