Windows 7 .net Excel .SaveAs() Error Exception from HRESULT: 0x800A03EC

后端 未结 6 730
情书的邮戳
情书的邮戳 2020-11-30 04:21

Background:
I toasted my old hard drive at work and am getting a new one. With that I\'ll have to rebuild my machine. My manager has Windows 7 installed on him loaner la

相关标签:
6条回答
  • 2020-11-30 04:45

    When I was getting this error, I think I started using .SaveCopyAs instead of SaveAs. I'm not sure what other errors this is causing you, if you could elaborate there perhaps something could be figured out for that situation.

    Also, one thing that you are doing is most likely causing excel.exe to remain in memory after processing a file. Here is an article that shows the proper way to use and release COM interop objects (http://support.microsoft.com/kb/317109). It is a pain, but it worked for me in allowing those resources to be released before the app closed.

    0 讨论(0)
  • 2020-11-30 04:46

    The answer above by Jeff Keslinke ended up working for me. You also need to look at the application pool that your App is using and make sure the identity is correct and has full access and privileges.

    0 讨论(0)
  • 2020-11-30 04:52

    Make sure you're running the program (and EXCEL.EXE) as administrator, and the directory you're saving to doesn't have "read-only" attribute on.

    Also, try passing the full file path instead of just the file name.

    You could also try passing System.Reflection.Missing.Value instead of omitting the optional parameters.

    Can't think of anything else right now. Hope this helps.

    ShdNx

    0 讨论(0)
  • 2020-11-30 04:52

    I got the same issue and found application crash errors with Exception code: 0xc0000005 in windows events. Search web and find the following solution at the linkExcel 2010 Crash, Exception code: 0xc0000005 Rename the file extension of the opened file from xlsx to zip. The solution works for my case.

    0 讨论(0)
  • 2020-11-30 05:02

    Note: This needs to be condensed a bit as it's a compilation of all the fixes I've been making on our internal wiki but I'm not sure what subset of changes made it work so I'll include it all.

    Solution:

    The following changes may be a superset of how to address this problem.

    -Run DCOMCNFG.exe and navigate to 'Component Services>Computers>My Computer'.
    -Right click 'My Computer' and click 'Properties'.
    -Open the 'COM Security' tab. Add your account for everyone of the buttons listed ('Edit Limits...' and 'Edit Default...' buttons under 'Access Permission' & 'Launch and Activate Permissions'). Give your account all access options. Click 'Apply' then 'OK'.
    -While still in DCOMCNFG expand the 'My Computer' link and open the 'DCOM Config' folder.
    -Right click on 'Microsoft Excel Application' and select 'Properties'.
    -Under the 'Security' tab choose the 'Customize' option for 'Launch and Activation Permissions' and 'Configuration Permissions'. For both click the 'Edit...' button. Give your account access to everything.
    -While still in the 'Properties' for 'Microsoft Excel Application' go to the 'Identity' tab.
    -Select the 'The Interactive User' option.
    -Click 'Apply' then 'OK'.
    -Restart your computer.

    -Try the below DCOMCNFG & ApplicationPoolIdentity change.

    -Run command prompt as Administrator.
    -Navigate to c:\Windows\System32\inetsrv> and run 'appcmd set config -section:asp -enableParentPaths:true'

    Alternately you could use .SaveCopyAs() although this may still not address the problem and will require code changes.

    DCOMCNFG For windows 7:

    This error happens on 'Excel app = New Application();' calls

    This link details how to fix the problem for XP/Server 2003 but can be adapted to Windows 7: http://blog.crowe.co.nz/archive/2006/03/02/589.aspx

    I do not have/could not find an 'ASPNET' account. You have to check the application pool to find out what the app is running as.
    To do that go into 'Computer Management>Services and Applications>Internet Information Services>Application Pools'
    Right click on the appropriate AppPool and choose 'Advanced Settings'. Under 'Process Model>Identity' you can find the account it is running under. Mine was 'ApplicationPoolIdentity' which I also couldn't find so I changed it to 'Network Service' like Windows Server 2003.
    Once this is set run DCOMCNFG.exe. Navigate to 'Component Services>Computers>My Computer>DCOM Config'.
    Find and right-click on 'Microsoft Excel Application' and select 'Properties'. Choose the 'Security' tab. Under 'Launch and Activation Permissions' choose 'Customize' and click 'Edit'.
    Then click the 'Add...' button.
    Type the name of the the appropriate account, in this case 'Network Service' and click 'Check Names'. Then click 'OK'.
    Back on the 'Launch and Activation Permissions' page highlight the 'Network Service' account and check the 'Local Launch' and 'Local Activation' check boxes. Then click 'OK'.

    0 讨论(0)
  • 2020-11-30 05:05

    Try turning on ISS . The details are mentioned here for windows 7

    http://helpdeskgeek.com/windows-7/turn-on-microsoft-internet-information-services-in-windows-7/

    0 讨论(0)
提交回复
热议问题