System.Runtime.InteropServices.COMException (0x80010105): сервер создал исключение. (Исключение из HRESULT: 0x80010105 (RPC_E_SERVERFAULT))
Привет, могу ли я получить некоторое представление о том, как это исправить? Я получаю эту ошибку каждый раз, когда нажимаю на функцию, которая отправляет PDF-файлы по электронной почте. Я использую Microsoft Word 2007 на своем компьютере, вот ошибка и мой код, я Я получаю сообщение об ошибке на wdapp.Documents.Open
Error
System.Runtime.InteropServices.COMException (0x80010105): сервер создал исключение. (Исключение из HRESULT: 0x80010105(RPC_E_SERVERFAULT)) в Microsoft.Office.Interop.Word.Documents.Open(Object& FileName, Object&ConfirmConversions, Object& ReadOnly, Object& AddToRecentFiles,Object& PasswordDocument, Object& PasswordTemplate, Object&Revert, Object& WritePasswordDocument, Object& WritePasswordTemplate,Object& Format, Object& Encoding, Object& Visible, Object&OpenAndRepair, Object& DocumentDirection, Object& NoEncodingDialog,Object& XMLTransform) в Choc.Filehandlr.ProInte.ConvertWordToPDF(List`1 fileList, StringFileNo, String bUnit) в C:\Users\monkeydluffy\Desktop\Choc.Filehandlr\Choc.Filehandlr\Choc.Filehandlr\Common\Choc.Integ.cs:line191pdfFiles coutn: 1trace111trace222Не удалось найти файл 'c:\ConvertLocation\botique\Ace-botique-AT14\Ace-botique-no16-copperwire.pdf'.sp Контекст: http://sharepoint/ace-botique/useritem в коллекции файлов: 6. Количество возвращаемых файлов: 1filecount: 1 имя файла: c:\ConvertLocation\botique\Ace-botique-AT14\file1.docx.
wdapp.Visible = false;
wdapp.ScreenUpdating = false;
foreach (FileInfo wordFile in wordFiles)
{
// Cast as Object for word Open method
Object filename = (Object)wordFile.FullName;
//Test trace only
EventTracer.Instance.Trace(Constants.TraceSettings.ERRORSONLY_Option, string.Format("filename: {0}\r\n", filename));
// Use the dummy value as a placeholder for optional arguments
wdInterpo.Document doc = wdapp.Documents.Open(ref filename, ref oMissing, ref oMissing, ref oMissing, ref oMissing,
ref oMissing, ref oMissing, ref oMissing, ref oMissing, ref oMissing,
ref oMissing, ref oMissing, ref oMissing, ref oMissing, ref oMissing, ref oMissing);
doc.Activate();
//Test trace only
EventTracer.Instance.Trace(Constants.TraceSettings.ERRORSONLY_Option, string.Format("document: {0}\r\n", doc.Name));
string fName = wordFile.FullName.Replace(".docx", ".pdf");
fName = fName.Replace(".doc", ".pdf"); // incase document is from older version of word
object outputFileName = fName;
object fileFormat = wdInterpo.WdSaveFormat.wdFormatPDF;
// Save document into PDF Format
doc.SaveAs(ref outputFileName,
ref fileFormat, ref oMissing, ref oMissing,
ref oMissing, ref oMissing, ref oMissing, ref oMissing,
ref oMissing, ref oMissing, ref oMissing, ref oMissing,
ref oMissing, ref oMissing, ref oMissing, ref oMissing);
// Close the Word document, but leave the Word application open. // doc has to be cast to type _Document so that it will find the // correct Close method.
object saveChanges = wdInterpo.WdSaveOptions.wdDoNotSaveChanges;
((wdInterpo._Document)doc).Close(ref saveChanges, ref oMissing, ref oMissing);
doc = null;
}
// word has to be cast to type _Application so that it will find // the correct Quit method.
((wdInterpo._Application)wdapp).Quit(ref oMissing, ref oMissing, ref oMissing);
wdapp = null; // com object must be destroy properly
}
catch (Exception ex)
{
wdapp = null; // com object must be destroy properly
EventTracer.Instance.Trace(Constants.TraceSettings.ERRORSONLY_Option, ex.ToString());
}
- файлы в моей папке застряли, и в большинстве случаев файлы PDF не отправляются по электронной почте.
- Я получаю сообщение об ошибке выше, я уже настроил приложение
- В IIS уже включен пул приложений 32 бит = true и профиль загрузки = true
- Все установленные в моих пакетах Nuget обновлены.
- ДокументФормат.OpenXml
- Microsoft.Office.Interop.Excel
- Microsoft.Office.Interop.Word
- Microsoft.SharePoint.Клиент
- PDFsharp