Lỗi khi tạo QRCode xuất file excel Exception from HRESULT: 0x800A03EC

Theo: nguyenhaidang.name.vn | 30/09/2019 - 04:21

 

 
Rate me!
 
See more: 
I am using a Windows based application which uses COM Interop Excel in which the excel exports fails. This works in the development environment. But it fails when promoted to other environment.

Also the problem is it is not reproducible in local environment.

We are using Microsoft.Interop.Excel for opening the excel and updating the data.

While trying to add the workbook using Workbooks.Add method we are getting the following
error :


System.Runtime.InteropServices.COMException.Exception from HRESULT:0X800A03EC
at Microsoft.Office.Interop.Excel.Workbooks.Add(Object Template)

Code :

thisWorkbook = OpenTemplate(new System.IO.FileInfo("XLSTemplate\\Test.xlsx"));


public Workbook OpenTemplate(FileInfo xlsFile)
{
Workbook wb = null;

try
{
wb = Workbooks.Add(xlsFile.FullName);
template = xlsFile;

if (wb != null)

{
if (!DebugOut.IsDebug & wb.Worksheets.Count > 0)
((_Worksheet)wb.Worksheets[1]).Activate();
}
}
catch (Exception ex)
{
System.Diagnostics.Debug.WriteLine(ex);
throw new Exception("Error in OpenTemplate",ex);
}
return wb;
}

Any help and solution would be much appreaciated.

Solution 1

 
Are the OS different in both environment? Is it Window 2008 Server? If so try creating Desktop folder as below if not present already in the environment where this is failing.

Windows 2008 Server (64 Bit): C:\Windows\SysWOW64\config\systemprofile\Desktop
Windows 2008 Server (32 Bit): C:\Windows\System32\config\systemprofile\Desktop
 Solution 2:
Vào IIS chọn Application Pools --> Click phải vào website --> Advanced Settings --> như hình (lưu ý: phải chọn Identity sang LocalSystem)

Nguồn: https://www.codeproject.com/Questions/574791/COMplusExceptionplushresultplus0x800a03ecplusatplu

Back Head Print
Tin khác

Search GridView with Paging on TextBox KeyPress using jQuery in ASP.Net    (28/07/2010)

Bootstrap AutoComplete TextBox example using jQuery TypeAhead plugin in ASP.Net with C# and VB.Net    (28/07/2010)

Disable Button and Submit button after one click using JavaScript and jQuery    (29/07/2010)

Split and convert Comma Separated (Delimited) String to Table in SQL Server    (01/09/2010)

Select Column values as Comma Separated (Delimited) string in SQL Server using COALESCE    (01/09/2010)