This project has moved. For the latest updates, please go here.

Cannot save() Excel doc on server

Nov 13, 2012 at 3:53 PM

I have copied Sample4 from the web samples (using EPPLUS V3.1.2). It basically creates a very simple xlsm file with some VBA added. This works fine on my local machine, however when I copy the solution to a web server for testing it errors on the following line:

"Object reference not set to an instance of an object."

Not sure it makes any difference but the web server is 64 bit and my local machine is 32 bit? I have tried using the save() method instead of GetAsByteArray() but I get the same result. Has anyone come accross similar issues?

Here's the stack trace:
[NullReferenceException: Object reference not set to an instance of an object.]
   System.Runtime.InteropServices.Marshal.ReleaseComObject(Object o) +132
   OfficeOpenXml.Utils.CompoundDocument.Save() +417
   OfficeOpenXml.VBA.ExcelVbaProject.Save() +1127
   OfficeOpenXml.ExcelWorkbook.Save() +535
   OfficeOpenXml.ExcelPackage.GetAsByteArray(Boolean save) +34
   OfficeOpenXml.ExcelPackage.GetAsByteArray() +10
   Tasks.ibtExportToExcel_Click(Object sender, EventArgs e) in e:\homer.test\ADAS_Systems\System42\Tasks.aspx.cs:583
   System.Web.UI.WebControls.ImageButton.OnClick(ImageClickEventArgs e) +108
   System.Web.UI.WebControls.ImageButton.RaisePostBackEvent(String eventArgument) +118
   System.Web.UI.WebControls.ImageButton.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

Nov 14, 2012 at 12:30 PM

I have recently discovered that the problems I'm experiencing are down to iis, more specifically impersonation. My anonymous user has full access to by bin folder in my web app, does anyone know what else I would need to give the user access to in order for EPPlus to work?

Feb 9, 2014 at 5:49 PM
To anyone experiencing this problem, it indicates that you don't have permissions to write to TEMP.
Also check for pagefile