Hi every one,
I am using microsoft interop service to read word document content in asp.net application. Its working very well in local. But i configured in IIS i am geeting the error like
This file could not be found. (http://localhost/.../ProDoc79V1.docx)
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.Runtime.InteropServices.COMException: This file could not be found. (http://localhost/.../ProDoc79V1.docx)
Source Error:
Line 382: string retstr = "";
Line 383: Word.Application wordApplication = new Word.Application();
Line 384: Word.Document newDocument = wordApplication.Documents.Open(filepath);
Line 385: wordApplication.Visible = false;
Line 386: retstr = newDocument.Content.Text;
|
Source File: d:\kasiraja\DMSGCC\Leto\DocumentMaster.aspx.cs Line: 384
Stack Trace:
[COMException (0x800a1436): This file could not be found.
(http://localhost/.../ProDoc79V1.docx)]
[TargetInvocationException: Exception has been thrown by the target of an invocation.]
System.RuntimeType.InvokeDispMethod(String name, BindingFlags invokeAttr, Object target, Object[] args, Boolean[] byrefModifiers, Int32 culture, String[] namedParameters) +0
System.RuntimeType.InvokeMember(String name, BindingFlags bindingFlags, Binder binder, Object target, Object[] providedArgs, ParameterModifier[] modifiers, CultureInfo culture, String[] namedParams) +555
NetOffice.Invoker.MethodReturn(COMObject comObject, String name, Object[] paramsArray) +267
[COMException (0x80004005): See inner exception(s) for details.]
NetOffice.Invoker.MethodReturn(COMObject comObject, String name, Object[] paramsArray) +373
NetOffice.WordApi.Documents.Open(Object fileName) +78
Leto_DocumentMaster.newwordcontentnew(String filepath, String filetype) in d:\kasiraja\DMSGCC\Leto\DocumentMaster.aspx.cs:384
Leto_DocumentMaster.btnSave_Save(Object sender, EventArgs e) in d:\kasiraja\DMSGCC\Leto\DocumentMaster.aspx.cs:323
System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument) +154
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +369
|
Here my code:
object path = Request.PhysicalApplicationPath + "Leto\\DocumentFiles\\Pro.docx";
Microsoft.Office.Interop.Word.Application wordApplication = new Microsoft.Office.Interop.Word.Application();
Microsoft.Office.Interop.Word.Document newDocument = wordApplication.Documents.Open(path);
retstr = newDocument.Content.Text;
wordApplication.Visible = false;
wordApplication.ActiveWindow.Visible = false;
wordApplication.Documents.Close();
Any one give me the solution for this....
Thank you