C# 检索组件的COM类工厂失败。访问被拒绝。HRESULT:0x80070005 E_访问被拒绝
尝试在邮件中打开Outlook以获取附件时,通过IIS asp.net网站收到此错误。将在DCOMCnfg中具有完全权限的IIS USR和网络分配给Microsoft OutLook组件,但不起任何作用 由于以下错误,检索CLSID为{0006F03A-0000-0000-C000-0000000000 46}的组件的COM类工厂失败:80070005访问被拒绝。(来自HRESULT的异常:0x80070005(E_ACCESSDENIED)) Outlook对象模型(与任何其他Office应用程序一样)无法从服务(如IIS)中使用。 除此之外,您还试图在服务器端显示一条消息,在那里没有人会看到它 你可以用任何一种C# 检索组件的COM类工厂失败。访问被拒绝。HRESULT:0x80070005 E_访问被拒绝,c#,asp.net,email,outlook,interop,C#,Asp.net,Email,Outlook,Interop,尝试在邮件中打开Outlook以获取附件时,通过IIS asp.net网站收到此错误。将在DCOMCnfg中具有完全权限的IIS USR和网络分配给Microsoft OutLook组件,但不起任何作用 由于以下错误,检索CLSID为{0006F03A-0000-0000-C000-0000000000 46}的组件的COM类工厂失败:80070005访问被拒绝。(来自HRESULT的异常:0x80070005(E_ACCESSDENIED)) Outlook对象模型(与任何其他Office应用
嗨,德米特里,你能给我看看任何工作的例子或与之相关的链接吗?我正在我的本地主机站点上尝试此操作,并分配了所有可能的权限,但错误相同。如果可能的话,我会非常感激的。举个什么例子?上面6个选项中的哪一个?嗨,Dmitry,你能给我看一些工作示例或链接吗?我正在我的本地主机站点上尝试此操作,并分配了所有可能的权限,但错误相同。如果可能的话,我会非常感激的。举个什么例子?以上6个选项中的哪一个?
using System;
using Outlook = Microsoft.Office.Interop.Outlook;
// Create the Outlook application.
Outlook.Application oApp = new Outlook.Application();
// Create a new mail item.
Outlook.MailItem oMsg = (Outlook.MailItem)oApp.CreateItem(Outlook.OlItemType.olMailItem);
// Set HTMLBody.
//add the body of the email
oMsg.HTMLBody = "Hello, This is test for sending pdf attachment using OutLook";
//Add an attachment.
String sDisplayName = "MyAttachment";
int iPosition = (int)oMsg.Body.Length + 1;
int iAttachType = (int)Outlook.OlAttachmentType.olByValue;
//now attached the file
Outlook.Attachment oAttach = oMsg.Attachments.Add(Server.MapPath("~/TestSendFile.pdf"), iAttachType, iPosition, sDisplayName);
//Subject line
oMsg.Subject = "Your Subject will go here.";
// Add a recipient.
Outlook.Recipients oRecips = (Outlook.Recipients)oMsg.Recipients;
// Change the recipient in the next line if necessary.
Outlook.Recipient oRecip = (Outlook.Recipient)oRecips.Add("user1@comecompany.com");
oRecip.Resolve();
// Send.
oMsg.Display();