(Sumber: milist DOTNET) Error Open Excel di Web
-
jueves, 28 de junio de 2012 10:48Moderador
Dear para master,saya sedang membuat aplikasi untuk membuka Excel di asp.net, sintak nya kurang lebih kyk giniExcel.Workbook excelWorkBook = excelApp.Workbooks.Open(filePath, 0, true, 5, "", "", true, Excel.XlPlatform.xlWindows, "\t", false, false, 0, true, Type.Missing, Type.Missing);try{Excel.Sheets excelSheets = excelWorkBook.Worksheets;Excel.Worksheet excelSheet = (Excel.Worksheet)excelSheets.get_Item(1);}}catch (Exception ex){context.Response.Write(ex.Message);}finally{if (excelWorkBook != null){excelWorkBook.Close(false, Type.Missing, Type.Missing);System.Runtime.InteropServices.Marshal.ReleaseComObject(excelWorkBook);excelWorkBook = null;}if (excelApp != null){excelApp.Quit();System.Runtime.InteropServices.Marshal.ReleaseComObject(excelApp);excelApp = null;}}yang jadi masalah setiap "excelWorkBook.Close(false, Type.Missing, Type.Missing);" atau sedang melakukan pembacaan cell suka muncul error "The RPC server is unavailable."
setalah googling kata nya masalah dengan firewall, tapi setelah di matiin firewall nya tetep error.
mungkin rekan-rekan ada yang pernah mengalami error yang serupa ?
mohon bantuan nya..
Agnes Sannie [MSFT]
MSDN Community Support | Feedback to us
Get or Request Code Sample from Microsoft
Please remember to mark the replies as answers if they help and unmark them if they provide no help.
Todas las respuestas
-
jueves, 28 de junio de 2012 10:48Moderador
ini maenan lama nih, dan penyakit lama juga;)
coba cek DCOM dari Excel ini untuk allow access. kalau IIS, maka user ASP.NET atau user yang digunakan oleh Application Pool IIS itu memiliki hak akses disini.
Ingat, maenan Excel di IIS, itu tidak dianjurkan krn memang Excel atau office automation itu tidak di desain untuk bekerja dalam concurrent processing atau multi threading apartment. Cek arsitektur IIS dimana semua proses reques/respon bekerja diatas multithread apartment jadi jgn mengulangi kesalahan saya dulu dulu dulu banget msh zamannya .NET awal. Dan ingat pakai office di ASP.NET itu kena bayar license Excel/Office per user;)). Kalau utk internet user? wuih.. makin mahal;) kecuali bisa nego dengan Microsoft Indonesia;). pengalaman pribadi, gak perlu sebut nama #eh.
Microsoft juga tdk menganjurkan tentang penggunaan Excel atau office automation dalam ASP.NET, cek http://support.microsoft.com/default.aspx?scid=kb;EN-US;q257757#kb2 . Kalau masih "ngebet" pakai Excel atau Office maka bisa pakai thirdparty yang memang didesign untuk multihread appartment IIS contohnya http://www.aspose.com/categories/.net-components/aspose.cells-for-.net/default.aspx . Gak mampu beli license nya? jangan kuatir the power of community project, ada yang open source, cek http://epplus.codeplex.com/ , yng ini belum review katanya bagus...saya belum coba krn belum ada proyek excel2x office di asp.net lagi #eh.
Dijawab oleh: Agus Kurniawan
Agnes Sannie [MSFT]
MSDN Community Support | Feedback to us
Get or Request Code Sample from Microsoft
Please remember to mark the replies as answers if they help and unmark them if they provide no help.- Marcado como respuesta Agnes SannieMicrosoft Contingent Staff, Moderator jueves, 28 de junio de 2012 10:48
-
jueves, 28 de junio de 2012 10:49Moderador
Setuju dengan boss akur. Tidak disarankan pake excel di atas IIS.
Gw pernah pake epplus, sudah cukup untuk sekedar baca file excel.Dijawab oleh: Ahmad Masykur
Agnes Sannie [MSFT]
MSDN Community Support | Feedback to us
Get or Request Code Sample from Microsoft
Please remember to mark the replies as answers if they help and unmark them if they provide no help.

