Click here to Skip to main content
15,898,588 members
Please Sign up or sign in to vote.
5.00/5 (1 vote)
See more:
I am getting error:
System.Runtime.InteropServices.COMException (0x800A03EC): Microsoft Office Excel cannot open or save any more documents because there is not enough available memory or disk space. • To make more memory available, close workbooks or programs you no longer need. • To free disk space, delete files you no longer need from the disk you are saving to.

This error I get while I deployed my APP in server 2008 in production envirnment.

Locally it's working fine.

I am using Excel 2007 to write data. and same I have installed in server also.

My functional requirement is we need to write data in Excel runtime and to send as an attachment in mail.


I have already given all permission using COMPOnent Service and I tried changeing Identity to administrator to run app. Then also getting same issue.

Anybody can help me on this as this solution is bit urgent.

Thanks in advance.
Posted

Fixing permissions (Windows server 2008)

A.Windows 2008 Server x64

Please make this folder:
C:\Windows\SysWOW64\config\systemprofile\Desktop

And give write permissions to the "IIS AppPool\DefaultAppPool" user in those folders:
C:\Windows\SysWOW64\config\systemprofile\Desktop
C:\Windows\SysWOW64\config\systemprofile\AppData\Roaming\Microsoft
C:\Windows\SysWOW64\config\systemprofile\AppData\Local\Microsoft


B.Windows 2008 Server x86

Please make this folder:
C:\Windows\System32\config\systemprofile\Desktop

And give write permissions to the "IIS AppPool\DefaultAppPool" user in those folders:
C:\Windows\System32\config\systemprofile\Desktop
C:\Windows\System32\config\systemprofile\AppData\Roaming\Microsoft
C:\Windows\System32\config\systemprofile\AppData\Local\Microsoft
 
Share this answer
 
v2
Comments
Vishal Sanchihar 1981 30-Jul-10 6:19am    
Reason for my vote of 4
yes adoptable...
waelove 8-Jul-12 3:23am    
thanks
I foolowed that
but at a previous try
i forget to give permissions for
C:\Windows\System32\config\systemprofile\AppData\Roaming\Microsoft
prabhatkumar.ssd 20-Aug-14 9:40am    
Thanks for saving my night :)
Tarek Selem 24-May-15 10:23am    
What about Windows Service C#??
SPEMoorthy 15-Jul-15 13:09pm    
Working ... Thanks
If you have disc space available, then it has to be a permissions issue, surely ? Even if you think it can't be, what else can it be ?
 
Share this answer
 
I think this is happening when too many instances of excel has been opened. Your com object was not released properly after use. Check your Task manager while the error is comming and look for Excel.exe in application tab. If you find so many instances of Excel.Exe then you need to release the COM object explicitly after use and re-create another excel application.
 
Share this answer
 
Comments
Vishal Sanchihar 1981 14-Jun-10 1:44am    
There is no Excel.exe in task process. and also there are enough space in DISK..

For more detail.... here is my code example:


Microsoft.Office.Interop.Excel.Application ExcelApp;
Workbook ExcelWorkbook;

ExcelApp = new Microsoft.Office.Interop.Excel.Application();
ExcelWorkbook = ExcelApp.Workbooks.Add(); // Error is comming in this line...


awaiting for helpful solution....
Goutam Patra 14-Jun-10 4:46am    
Check in you server machines Task manager. There must be a Excel.Exe in your application tab.

Alernatively try

Dim ExcelApp As Object
ExcelApp = createobject("Excel.Application")
ExcelWorkbook = ExcelApp.Workbooks.Add();

and let me know
No there is no Excel.exe in Task manager...
any way no I have changed my way of writing Excel...
Now I am using Open XML...
Ex...
using DocumentFormat.OpenXml.Packaging;
using DocumentFormat.OpenXml.Spreadsheet;

File.Copy("C:\vis.xlsx", "C:\Attachment\vis.xlsx", true);
using (SpreadsheetDocument myWorkbook = SpreadsheetDocument.Open("C:\Attachment\vis.xlsx", true))
{
// Access the main Workbook part, which contains all references.
WorkbookPart workbookPart = myWorkbook.WorkbookPart;

// Get the first worksheet.
WorksheetPart worksheetPart = workbookPart.WorksheetParts.ElementAt(2);
// The SheetData object will contain all the data.
SheetData sheetData = worksheetPart.Worksheet.GetFirstChild<SheetData>();

int index = 1;
// Cell related variable
string Nom = "content to write";

// New Row
Row row = new Row();
row.RowIndex = (UInt32)index;
// New Cell

Cell cell = new Cell();
cell.DataType = CellValues.InlineString;
// Column A1, 2, 3 ... and so on
cell.CellReference = "A1";
// Create Text object
Text t = new Text();
t.Text = Nom;
// Append Text to InlineString object
InlineString inlineString = new InlineString();
inlineString.AppendChild(t);
// Append InlineString to Cell
cell.AppendChild(inlineString);

// Append Cell to Row
row.AppendChild(cell);


sheetData.AppendChild(row);
// Append Row to SheetData

worksheetPart.Worksheet.Save();



myWorkbook.Close();

}


------

and Finally there is no issue...
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900