I have simple procedure for converting xlsx to csv.
public static void ConvertExcelToCsv(string source, string destination, int sheetNumber = 1)
{
if (File.Exists(destination)) File.Delete(destination);
Excel.Application xl = new Excel.Application();
xl.DisplayAlerts = false;
Excel.Workbook workbook = xl.Workbooks.Open(source);
// workbook.Close(true);
workbook.SaveAs(destination, Microsoft.Office.Interop.Excel.XlFileFormat.xlCSV);
object misValue = System.Reflection.Missing.Value;
if (workbook != null)
{
workbook.Close(false, Type.Missing, Type.Missing);
xl.Workbooks.Close();
Marshal.ReleaseComObject(workbook);
}
xl.Quit();
GC.Collect();
Marshal.FinalReleaseComObject(xl);
}
Everything works fine on my local machine and also local IIS. But after uploading onto web server seems to don't work. Everything what it does is processing about 3 mins and then time out.
I also allowed permissions in Component
Services -> Computers -> My Computer -> DCOM Config -> Microsoft Excel Application -> IIS_IUSRS
and also created Desktop folders
C:\\Windows\\SysWOW64\\config\\systemprofile\\
and also in 32bit :-)
So right now, I have no idea, why it doesn't work. Do you have similar experience with this or can you provide some hint what should I do, please.
What is the exact error that you receive? Check your IIS logs and the Application event log for specific errors.
A couple things to check for:
source
and destination
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.