Windows 7 .net Excel .SaveAs()来自HRESULT的错误异常:0x800A03EC [英] Windows 7 .net Excel .SaveAs() Error Exception from HRESULT: 0x800A03EC

查看:159
本文介绍了Windows 7 .net Excel .SaveAs()来自HRESULT的错误异常:0x800A03EC的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

背景:

我在工作中烤了我的旧硬盘,并且获得了新的硬盘。因此,我必须重建我的机器。我的经理有Windows 7安装在他的借阅笔记本电脑,我一直在使用,而我的机器是不合格的。但是我遇到了一个问题。

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 laptop that I've been using while my machine is out of commision. But I've run into a problem.

我们有相当数量的使用Microsoft.Office.Interop.Excel引用的应用程序。到目前为止,我已经过了一些错误,但是在过去几天我被困住了(我的机器在第一次重建之后实际上遭受了硬盘故障),并且一直没有找到修复。我搜索了这个错误,但找不到任何人有这个问题在Windows 7,虽然我已经尝试Windows Server 2008的其他修复程序无效。

We have a fair number of apps that make use of the Microsoft.Office.Interop.Excel reference. I've gotten past a few errors so far but the one I've been stuck on for the last few days (my machine actually suffered the hard drive failure after the first rebuild) and have been unnable to find a fix. I have searched for this error but can't find anyone having this problem on Windows 7, although I have tried other fixes for Windows Server 2008 to no avail.

如果我无法解决这个问题,我将无法使用Windows 7,并且想知道在重建机器之前,只需要擦拭并重新开始(第三次)。

If I can't fix this problem, I will not be able to use Windows 7 and would like to know that before I rebuild a machine only to have to wipe it and start again (for the third time).

问题:

操作系统:Windows 7 Enterprise

错误消息:HRESULT异常:0x800A03EC

代码:

Problem:
OS: Windows 7 Enterprise
Error Message: Exception from HRESULT: 0x800A03EC
Code:

Private m_xls As Microsoft.Office.Interop.Excel.Application
Private m_wkbk As Microsoft.Office.Interop.Excel.Workbook
Private m_wksht As Microsoft.Office.Interop.Excel.Worksheet
m_xls = New Application
m_xls.Visible = False : m_xls.DisplayAlerts = False
m_wkbk = m_xls.Workbooks.Open(Me.FilePath)
m_wksht = CType(m_wkbk.ActiveSheet, Worksheet)
'...Write some data...'
m_wkbk.SaveAs(Me.FilePath, XlFileFormat.xlWorkbookNormal, Missing.Value, Missing.Value, False, False, XlSaveAsAccessMode.xlNoChange, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value)

错误发生在最后一行。

到目前为止我已经尝试过:

What I've tried so far:


  1. 将AppPool更改为使用
    NetworkService帐户(
    'ApplicationPoolIdentity',我
    找不到在用户列表中的
    安全设置)。然后给
    NetworkService帐户完全访问
    到相应的文件夹。

  2. 让NetworkService访问DCOMCNFG中的所有Microsoft Excel应用程序设置

  3. 运行此命令appcmd set config -section:asp -enableParentPaths:true,因为这是唯一可以找到的其他东西

  4. 使用.SaveCopyAs()导致不同的错误

  1. Changing the AppPool to use the NetworkService account (it was 'ApplicationPoolIdentity' which I couldn't find in the user list in security settings). Then giving the NetworkService account full access to the appropriate folder.
  2. Giving NetworkService access to all 'Microsoft Excel Application' settings in DCOMCNFG
  3. Running this command "appcmd set config -section:asp -enableParentPaths:true" because it's the only other thing I could find
  4. Using the .SaveCopyAs() which worked but caused different errors

只是想看看有没有人跑到这个或不是,因为Windows 7是新的。我可以和Server 2008一起去,但是在我告诉我的经理之前,我希望有一些坚实的理由。

I just wanted to see if anyone else has run into this or not since Windows 7 is new. I can go with Server 2008 but I would like to have some solid reasoning behind it before I tell my manager it won't work.

谢谢你,
Jeff

Thank you, Jeff

推荐答案

注意:这需要简化一下,因为它是我在我们所做的所有修复程序的汇编内部维基,但我不知道什么变化的一部分使它工作,所以我将包括所有。

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.

解决方案:

以下更改可能是如何解决此问题的超集。

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

-Run DCOMCNFG.exe并导航到组件服务>计算机>我的电脑。

- 点击我的电脑,然后点击属性。

打开COM安全选项卡。在访问权限和启动和激活权限下,列出所有按钮的所有人(编辑限制)和编辑默认值按钮添加您的帐户。为您的帐户提供所有访问选项。单击应用,然后单击确定。

- 仍然在DCOMCNFG中展开我的电脑链接并打开DCOM配置文件夹。

- 点击Microsoft Excel应用程序,然后选择属性。

- 在安全选项卡上选择启动和激活权限和配置权限的自定义选项。双击编辑...按钮。给你的帐户访问所有的东西。

- 仍然在'属性'为'Microsoft Excel应用程序'转到'身份'选项卡。

- 选择交互式用户'选项。

- 单击'应用'然后'确定'。

- 建立您的计算机。

-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.

- 尝试 ApplicationPoolIdentity更改。

-Try the below DCOMCNFG & ApplicationPoolIdentity change.

- 以管理员身份登录命令提示符。

- 导航到c:\Windows\System32\inetsrv>并运行'appcmd set config -section:asp -enableParentPaths:true'

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

另外也可以使用.SaveCopyAs(),尽管这可能仍然无法解决问题,并且需要更改代码。

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

DCOMCNFG对于Windows 7:

DCOMCNFG For windows 7:

错误发生在'Excel应用程序=新应用程序();'调用

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

此链接详细说明如何解决XP / Server 2003的问题,但可以适应Windows 7: http://blog.crowe.co.nz/archive/2006 /03/02/589.aspx

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

我没有/找不到ASPNET帐户。您必须检查应用程序池,以了解应用程序的运行情况。

进行计算机管理>服务和应用程序> Internet信息服务>应用程序池

右键单击相应的AppPool,然后选择高级设置。在过程模型>身份下,您可以找到它所运行的帐户。我的ApplicationPoolIdentity我也找不到,所以我改为网络服务像Windows Server 2003.

一旦这个设置运行DCOMCNFG.exe。导航到组件服务>计算机>我的电脑> DCOM配置。

找到并右键单击Microsoft Excel应用程序,然后选择属性。
选择安全选项卡。在启动和激活权限下,选择自定义,然后单击编辑。

然后单击添加...按钮。

键入相应帐户的名称,在这种情况下为网络服务,然后单击检查名称。然后点击确定。

返回启动和激活权限页面,突出显示网络服务帐户,并检查本地启动和本地激活复选框。然后点击确定。

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'.

这篇关于Windows 7 .net Excel .SaveAs()来自HRESULT的错误异常:0x800A03EC的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆