Microsoft Office Excel 不能访问文件

南楼画角 提交于 2020-07-29 09:55:47

Microsoft Office Excel 不能访问文件

 

问题描述:

Microsoft Office Excel 不能访问文件“XX.xls”。可能的原因有:
1 文件名称或路径不存在。
2 文件正被其他程序使用。
3 您正要保存的工作簿与当前打开的工作簿同名。 
问题解决:
方法一:
  1:在服务器上安装office的Excel软件. 
  2:在 "开始 "-> "运行 "中输入dcomcnfg.exe启动 "组件服务 " 
  3.在"DCOM配置"中找到"Microsoft Excel 应用程序",在它上面点击右键,然后点击"属性",弹出"Microsoft Excel 应用程序属性"对话框
  4.点击"标识"标签,选择"交互式用户"
  5.点击"安全"标签,在"启动和激活权限"上点击"自定义",然后点击对应的"编辑"按钮,在弹出的"安全性"对话框中填加一个"NETWORK  SERVICE"用户(注意要选择本计算机名),并给它赋予"本地启动"和"本地激活"权限
  6.依然是"安全"标签,在"访问权限"上点击"自定义",然后点击"编辑",在弹出的"安全性"对话框中也填加一个"NETWORK  SERVICE"用户,然后赋予"本地访问"权限.
  7.依然是"安全"标签,在"配置权限"上点击"自定义",然后点击"编辑",在弹出的"安全性"对话框中也填加一个"NETWORK  SERVICE"用户,然后赋予"本地访问"权限.
  如果5,6,7没有用,再加一个“Everyone”用户
方法二:
  在 web.config文件下的
 <system.web>节点增加如下节点,那肯定行了。不过这个不好。     <identity impersonate="true" userName="机器管理员登录名" password="密码"/>
 
 
或者看这个
 

I found the problem is the layer of security in the server!

Creating the Desktop folder inside the C:\Windows\System32\config\systemprofile and giving the service account permission to access the desktop folder is not enough.

I modified the C:\Windows\System32\config (or C:\windows\SysWOW64\config) folder to allow permission to the service account in security tab.

Then I also had to set up the same permission for the sub folder C:\Windows\System32\config\systemprofile (or C:\windows\SysWOW64\config\systemprofile) for the service account.

This works!

 

如果出现如下错误提示:

Retrieving the COM class factory for component with CLSID {00024500-0000-0000-C000-000000000046} failed due to the following error: 8000401a The server process could not be started because the configured identity is incorrect. Check the username and password. (Exception from HRESULT: 0x8000401A).
 

Better is to move to Open XML or you can configure as below

Install MS Office Pro Latest (I used 2010 Pro)
Create User ExcelUser. Assign WordUser with Admin Group
Go to Computer -> Manage
Add User with below options
User Options Password Never Expires
Password Cannot Be Change
Com+ Configuration

Go to Control Panel - > Administrator -> Component Services -> DCOM Config
Open Microsoft Word 97 - 2003 Properties
General -> Authentication Level : None
Security -> Customize all 3 permissions to allow everyone
Identity -> This User -> Use ExcelUser /password        (这里我使用正常登录的管理员才成功)
Launch the Excel App to make sure everything is fine

 

https://stackoverflow.com/questions/17785063/retrieving-the-com-class-factory-for-component-error-80070005-access-is-de

 

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!