Has anybody done Excel automation from C# on Win Server 2008 64bit?
Have run into an interesting issue with code that works flawlesly on XP and Server 2003.
I'm using MS's PIA for Office 11. The application fails with generic error message : Exception from HRESULT: 0x800A03EC
I have traced this to the saving of the Excel workbook. First, some code
:
//create new Excel app
Microsoft.Office.Interop.Excel.Application EXL = new Microsoft.Office.Interop.Excel.ApplicationClass();
//new workbook
Workbook workbook = EXL.Workbooks.Add(XlWBATemplate.xlWBATWorksheet);
//new worksheet
Sheets sheets = workbook.Sheets;
Worksheet worksheet = (Worksheet)sheets.get_Item(1);
worksheet.Name = "data";
then follows some code to populate the worksheet, and finally, save and close:
workbook.Close(true, fileName, Type.Missing);
EXL.Quit();
The point of failure has been traced to the saving of the workbook. Editing and saving an existing workbook results in the same error.
The web is full of reports of this same issue (which seems to be permission based), with no working solution.
What I have tried without success:
1. Impersonation with administrator credentials
2. DCOM permissions
3. Filesystem permissions
4. IIS permissions
The weird thing is that the code works when stepping through it with the VS debugger. Again, it is worth noting that this problem only occurs on Server 2008 - eveywhere else is happy.
Can anybody offer some advise/insight?
Have run into an interesting issue with code that works flawlesly on XP and Server 2003.
I'm using MS's PIA for Office 11. The application fails with generic error message : Exception from HRESULT: 0x800A03EC
I have traced this to the saving of the Excel workbook. First, some code
//create new Excel app
Microsoft.Office.Interop.Excel.Application EXL = new Microsoft.Office.Interop.Excel.ApplicationClass();
//new workbook
Workbook workbook = EXL.Workbooks.Add(XlWBATemplate.xlWBATWorksheet);
//new worksheet
Sheets sheets = workbook.Sheets;
Worksheet worksheet = (Worksheet)sheets.get_Item(1);
worksheet.Name = "data";
then follows some code to populate the worksheet, and finally, save and close:
workbook.Close(true, fileName, Type.Missing);
EXL.Quit();
The point of failure has been traced to the saving of the workbook. Editing and saving an existing workbook results in the same error.
The web is full of reports of this same issue (which seems to be permission based), with no working solution.
What I have tried without success:
1. Impersonation with administrator credentials
2. DCOM permissions
3. Filesystem permissions
4. IIS permissions
The weird thing is that the code works when stepping through it with the VS debugger. Again, it is worth noting that this problem only occurs on Server 2008 - eveywhere else is happy.
Can anybody offer some advise/insight?