我有一个asp.net应用程序,我正在发送一封邮件,与附件的文件,这是存储在本地驱动器。编写的代码通过使用look.com对象来发送邮件。由于代码在客户端工作正常(没有错误工作正常),但我将应用程序部署到远程服务器,得到一个错误"操作中止(异常从hresult 0x80040e14 (E_ABORT))"。我试着在网上寻找解决方案,但任何一个解决方案都不能解决我的问题。
写的代码是
string ticks = DateTime.Now.Ticks.ToString();
Outlook.Application objOutlook = new Outlook.Application();
objOutlook.ActiveExplorer();
//application.Visible = true;
Outlook.Application outlookApp = new Outlook.Application();
Outlook.MailItem message = (Outlook.MailItem)outlookApp.CreateItem(Outlook.OlItemType.olMailItem);
message.Subject = "Test PPT";
message.Body = " find Test PPT attached tp this mail";
//message.Recipients.Add("MyMailID@gmail.com");
message.Body = "Please find Test PPT attached tp this mail";
message.Attachments.Add(@"D:TempFilesAttachedPPT" + ticks + ".pptx", message.Body.Length + 1, Outlook.OlAttachmentType.olByValue, "MyAttachment");
message.Display(false);
是否有人告诉为什么我得到错误时,部署到远程服务器只。
微软目前不建议,也不支持,从任何无人值守的、非交互式的客户端应用程序或组件(包括ASP、ASP、ASP、ASP和ASP. xml)自动化Microsoft Office应用程序。. NET、DCOM和NT服务),因为在此环境中运行Office时,Office可能会表现出不稳定的行为和/或死锁。
查看更多信息链接