0x800A03EC error when call open or saveas in service on server 200

D

dragonemp

I have a windows service using office 2003 PIA to create/read excel
spreadsheets. and it works fine on xp or windows server 2003.
However when I move to windows server 2008, it always have problem on this
line:

_workBook.SaveAs(excelPhysicalFilePath,Excel.XlFileFormat.xlWorkbookNormal,null,null,false,false,Excel.XlSaveAsAccessMode.xlExclusive,false,false,null,null,null) ;
or
_workBook = (Excel.Workbook)(excelApp.Workbooks.Open(templatePath,0, false,
5, "", "", false, Excel.XlPlatform.xlWindows, "",true, false, 0, true, false,
false));

the error is System.Runtime.InteropServices.COMException (0x800A03EC):
Exception from HRESULT: 0x800A03EC

Please note, on a windows form app I created for testing purpose, the exact
same code runs fine. I can create/read file just fine.

So I assume it has something to do with the new way service/DCOM is handled
on windows server 2008/vista, can somebody help me solve the issue?

I also have another question for windows server 2008, in DCOM Config, I
tried change permission for some objects, however , property screens for few
of them are grayed out so I can't edit permission, any idea how I can change
the permission for these components?
 
S

sirrach

Did you ever resolve this issue with server 2008? We are running into the
same issue, it works on server 2003 but not 2008??
 
A

andrew_mtdata

I resolved this issue with the following steps

1. Login to the server as a administrator.
2. Go to "Start" -> "Run" and enter "taskmgr"
3. Go to the process tab in task manager and check "Show Processes from all
users"
4. If there are any "Excel.exe" entries on the list, right click on the
entry and select "End Process"
5. Close task manager.
6. Go to "Start" -> "Run" and enter "services.msc"
7. Stop the service automating Excel if it is running.
8. Go to "Start" -> "Run" and enter "dcomcnfg"
9. This will bring up the component services window, expand out "Console
Root" -> "Computers" -> "DCOM Config"
10. Find "Microsoft Excel Application" in the list of components.
11. Right click on the entry and select "Properties"
12. Go to the "Identity" tab on the properties dialog.
13. Select "The interactive user."
14. Click the "OK" button.
15. Switch to the services console
16. Start the service automating Excel
17. Test you application again.
 
M

Moski

Does your solution work when there is no interactive user logged in? Does it
work when the service starts automatically and you restart your server?
As for me, it works only when I'm logged in, but after I log off the
Excel.Application type initializer fails with this exception:

System.Runtime.InteropServices.COMException (0x8000401A): Retrieving the COM
class factory for component with CLSID {00024500-0000-0000-C000-000000000046}
failed due to the following error: 8000401a.
at
System.Runtime.Remoting.RemotingServices.AllocateUninitializedObject(RuntimeType objectType)
at
System.Runtime.Remoting.RemotingServices.AllocateUninitializedObject(Type
objectType)
at
System.Runtime.Remoting.Activation.ActivationServices.CreateInstance(Type
serverType)
at
System.Runtime.Remoting.Activation.ActivationServices.IsCurrentContextOK(Type
serverType, Object[] props, Boolean bNewObj)
 
M

Moski

It seems that I've found a solution which works for me:

- my service starts under local Administrator account
- on DCOM Config > MS Excel Application > Identity tab I've selected "This
user" option and also entered Administrator's account
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top