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

查看:762
本文介绍了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参考相当数量。我已经得到了过去的一些错误,但她的一个我一直停留在过去的几天(我的机器实际上遭受的硬盘驱动器出现故障后的第一个重建),并已unnable以找到一个解决。我搜索了这个错误,但无法找到任何有关于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企业
错误信息:从HRESULT异常:0x800A03EC
code:

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)

该错误的最后一行出现。

The error occurs on the final line.

我试过到目前为止:

  1. 更改程序池使用 网络服务帐户(这是 ApplicationPoolIdentity这是我 找不到在用户列表中的 安全设定)。然后给 网络服务帐户的完全访问权限 到相应的文件夹。
  2. 在赋予网络服务访问所有的Microsoft Excel应用程序设置,DCOMCNFG
  3. 在运行此命令appcmd设置配置-section:ASP -enableParentPaths:真正的,因为它是唯一的其他东西我能找到
  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.

感谢您, 杰夫

推荐答案

请注意:这需要凝聚了一点,因为它就是我一直在做的我们内部的wiki的修补程序的编译,但我不知道是什么变化的子集,使其工作,所以我会包括这一切。

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.

- 运行DCOMCNFG.EXE并导航到组件服务>计算机>我的电脑。
- 右单击我的电脑,然后单击属性。
- 打开COM安全选项卡。您的帐户添加为大家列出的按钮(编辑限制...和编辑默认值......下访问权限'和按钮;启动和激活权限)。给您的帐户的所有访问选项。点击应用,然后确定。
助益,而仍处于DCOMCNFG展开我的电脑链接,打开DCOM配置文件夹中。
- 右单击Microsoft Excel应用程序,然后选择属性。
- 下层 - 安全选项卡中选择自定义选项启动和激活权限和配置权限。对于这两种单击编辑...按钮。给所有帐户的访问。
助益,而仍然在属性为Microsoft Excel应用程序转到身份选项卡。
- 选择了交互式用户选项。
- 点击应用,然后确定。
-Restart您的计算机。

-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下面的 DCOMCNFG &放大器; ApplicationPoolIdentity改变。

-Try the below DCOMCNFG & ApplicationPoolIdentity change.

- 运行命令提示符管理员。
-Navigate到C:\ WINDOWS \ SYSTEM32 \ INETSRV>和运行APPCMD设置配置-section:ASP -enableParentPaths:真正的

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

另外,你可以使用.SaveCopyAs()虽然这可能还没有解决这个问题,将需要code的变化。

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的:<一href="http://blog.crowe.co.nz/archive/2006/03/02/589.aspx">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信息服务>应用程序池
右键点击相应的应用程​​序池,然后选择高级设置。在过程模型>身份,你可以找到它在其下运行的帐户。我的是'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天全站免登陆