Question : Exception from HRESULT: 0x800A03EC Interop Open Excel Workbook

I have a c# prject which when running locally can happily open and save excel workbooks using automation.  When I put the project on a web server I get Exception from HRESULT: 0x800A03EC if I trry to open a workbook or save one.  I am able to obtain a list of the files in the folder in which the workbook is located.

Any help would be greatly appreciated.


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: Exception from HRESULT: 0x800A03EC

Source Error:


Line 630:            Object objMissing = System.Reflection.Missing.Value;
Line 631:            object objFileFormat = (object)Microsoft.Office.Interop.Excel.XlFileFormat.xlHtml;
Line 632:            objBook = objBooks.Open(strFullPathToFile,
Line 633:                objMissing, //updatelinks
Line 634:                false, //readonly
 

Source File: c:\inetpub\wwwroot\WSWebServices\App_Code\Helpers.cs    Line: 632

Stack Trace:


[COMException (0x800a03ec): Exception from HRESULT: 0x800A03EC]
   Microsoft.Office.Interop.Excel.Workbooks.Open(String Filename, Object UpdateLinks, Object ReadOnly, Object Format, Object Password, Object WriteResPassword, Object IgnoreReadOnlyRecommended, Object Origin, Object Delimiter, Object Editable, Object Notify, Object Converter, Object AddToMru, Object Local, Object CorruptLoad) +0
   WSWebServices.App_Code.Helpers.GetExcelWorkSheet(String strFullPathToFile, Int32& intHwnd) in c:\inetpub\wwwroot\WSWebServices\App_Code\Helpers.cs:632
   ImportIdentityVerificationData.btnWorkWithFile_Click(Object sender, EventArgs e) in c:\inetpub\wwwroot\WSWebServices\Surveys\ImportIdentityVerificationData.aspx.cs:219
   System.Web.UI.WebControls.Button.OnClick(EventArgs e) +111
   System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument) +110
   System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) +10
   System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +13
   System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +36
   System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1565

 

Answer : Exception from HRESULT: 0x800A03EC Interop Open Excel Workbook

I solved this problem myself by using ExcelLibrary which seems much less quirky than using Interop

Thanks anyway
Random Solutions  
 
programming4us programming4us