I am using Shaman.EPPlus, a version of EPPlus that should be compatible with ASP.NET Core MVC.
I am trying to export a collection of object as xlxs file.
The code looks like
pck.Save();
....
var bytes = pck.GetAsByteArray();
Both calls will cause the package to be closed by Epplus. You do not need the .Save call since that will automatically be called by .GetAsByteArray anyway so simply remove the first line.