Excel 2007 automation on top of a Windows Server 2008 x64
2011-04-22 08:25
363 查看
今天在一个客户这边出来一个windows service的问题。这个service需要启动excel程序,并且对一些excel文件做一些操作。
环境是:windows server 2008 x64+Excel 2007
总是报告错误:(类似下面这样)
Service cannot be started. System.Runtime.InteropServices.COMException (0x800A03EC): Microsoft Office Excel cannot access the file 'c:/temp/test.xls'. There are several possible reasons: • The file name or path does not exist.
• The file is being used by another program.
• The workbook you are trying to save has the same name as a currently open workbook. 代码怎么看都是可以的,反复调试了service,问题最后解决了,大致有如下几点
Please make this folder. C:/Windows/SysWOW64/config/systemprofile/Desktop ・Windows 2008 Server x86 Please make this folder. C:/Windows/System32/config/systemprofile/Desktop ...instead of dcomcnfg.exe. This operation took away office automation problems in my system. A Desktop folder seems to be necessary in the systemprofile folder to open file by Excel. It disappears from Windows2008, Windows2003 had the folder,
and I think it cause this error. I think it is safer than "registry hack". If you try this solution, please let me know results.
环境是:windows server 2008 x64+Excel 2007
总是报告错误:(类似下面这样)
Service cannot be started. System.Runtime.InteropServices.COMException (0x800A03EC): Microsoft Office Excel cannot access the file 'c:/temp/test.xls'. There are several possible reasons: • The file name or path does not exist.
• The file is being used by another program.
• The workbook you are trying to save has the same name as a currently open workbook. 代码怎么看都是可以的,反复调试了service,问题最后解决了,大致有如下几点
第一步:在服务器添加有关的一个目录
这个方案参考了http://social.msdn.microsoft.com/Forums/en-US/innovateonoffice/thread/b81a3c4e-62db-488b-af06-44421818ef91?prof=required This solution is ... ・Windows 2008 Server x64Please make this folder. C:/Windows/SysWOW64/config/systemprofile/Desktop ・Windows 2008 Server x86 Please make this folder. C:/Windows/System32/config/systemprofile/Desktop ...instead of dcomcnfg.exe. This operation took away office automation problems in my system. A Desktop folder seems to be necessary in the systemprofile folder to open file by Excel. It disappears from Windows2008, Windows2003 had the folder,
and I think it cause this error. I think it is safer than "registry hack". If you try this solution, please let me know results.
第二步:设置服务与桌面交互
第三步:关闭服务器的UAC(这一步至关重要,调试了一个下午,就是因为这个问题卡住)
相关文章推荐
- Excel 2007 automation on top of a Windows Server 2008 x64
- Excel automation on Windows Server 2008 x64: solution to SaveAs method problem
- Excel Automation & Windows Server 2008 x64
- Setting up SFTP on Windows Server 2008 R2
- Configuring HTTP Access to SQL Server 2008 Analysis Services on Microsoft Windows Server 2008
- Windows Storage Server 2008 (x64)BT下载
- Using the multiple NICs of your File Server running Windows Server 2008 (and 2008 R2)
- Virtual PC 2007下安装windows 2008 server
- windows 2008 浏览asp发生错误,‘An error occurred on the server.....’
- [转]Win7、Windows Server 2008下无法在Windows Service中打开一个已经存在的Excel 2007文件问题的解决方案
- Windows 2008 / Windows 7 x64: The ‘Microsoft.Jet.OLEDB.4.0′ provider is not registered on the local
- GIT BASH IN INTELLIJ IDEA 13 ON WINDOWS One of the top features of the recent release of IntelliJ ID
- Win7、Windows Server 2008下无法在Windows Service中打开一个已经存在的Excel 2007文件问题的解决方案
- IIS setup on windows server 2008
- 在windows 2008 server x64系统上,是否可以操作office x86?
- How to install MOSS on Windows Server 2008 R2
- [转]Win7、Windows Server 2008下无法在Windows Service中打开一个已经存在的Excel 2007文件问题的解决方案
- Run iisapp on windows server 2008(debug webpart in vs and sharepoint)
- set up SMTP server on Windows 2008[备忘]
- BUG: "Old format or invalid type library" error when automating Excel on 64 bit server 2008