Excel File Empty When Code Deployed to Server

  • Thread starter Thread starter Martin.Swanston
  • Start date Start date
M

Martin.Swanston

Guest
Hi

An odd one. I have a C# web application (using .NET 4.7.1) which has a feature to download the data into an Excel spreadsheet. There is a template with all the headers in place, the code creates a temporary file, copies the contents from the template to that file and then populates it using ADO.

This process works without issue when deployed to the testing servers, and if I modify the web.config to point to the 'problem' connection, I get the download as expected (file size is ~5MB), but as soon as I deploy the code to the server, the resulting file is just an empty template. For the resulting download, none of the sheets (there are 12 of them) exceed 80 columns and all but one contain less than 4,000 rows, with that one being ~7,500 rows.

There is a similar process to extract filtered data, and this works without issue (using the same code) though this file is smaller (same number of sheets/columns as above but less rows - file size is ~4.7MB).

I know it's not database permissions as have had traces applied and all the queries work and return data, so it's something about the resulting file and the web server.

Are there any limitations to ACE/OLEDB? The connection string used is:

$"Provider=Microsoft.ACE.OLEDB.12.0;Data Source={exportFile};Extended Properties='Excel 12.0 xml;HDR=Yes'"

Where {exportFile} is a copy of the template held on the server whilst being populated.

The fact it works locally and on the test servers, plus for the smaller download, to me, proves that the code is sound, but there is just something about the larger export but I have no idea what it could be.

Are there any file size limitations using ACE/OLEDB?

Any help or advice gratefully received

Thanks

Martin

Continue reading...
 
Back
Top