您的位置:首页 > 其它

本地和服务器导出Excel报“Microsoft Office Excel 不能访问文件” 解决方法

2015-02-10 09:50 946 查看
最近在服务器和本地调用delphi写的导出Excel 的webservices,出现一系列配置和权限问题,现在一一记录下来。

Error 信息:

Server Error in '/' Application.

Microsoft Office Excel 不能访问文件“F:\TestServices\excel\kZ5bAf8b4Y-jianpin.xls”。 可能的原因有:

• 文件名称或路径不存在。
• 文件正被其他程序使用。
• 您正要保存的工作簿与当前打开的工作簿同名。 
 Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more
 information about the error and where it originated in the code. 

 Exception Details: System.Web.Services.Protocols.SoapHeaderException: Microsoft Office Excel 不能访问文件“F:\TestServices\excel\kZ5bAf8b4Y-jianpin.xls”。
 可能的原因有:

• 文件名称或路径不存在。
• 文件正被其他程序使用。
• 您正要保存的工作簿与当前打开的工作簿同名。

Source Error: 

 An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location 
of the exception can be identified using the exception stack trace below.  

Stack Trace: 

[SoapHeaderException: Microsoft Office Excel 不能访问文件“F:\TestServices\excel\kZ5bAf8b4Y-jianpin.xls”。 可能的原因有:

• 文件名称或路径不存在。
• 文件正被其他程序使用。
• 您正要保存的工作簿与当前打开的工作簿同名。]
   System.Web.Services.Protocols.SoapHttpClientProtocol.ReadResponse(SoapClientMessage message, WebResponse response, 
Stream responseStream, Boolean asyncCall) +507386
   System.Web.Services.Protocols.SoapHttpClientProtocol.Invoke(String methodName, Object[] parameters) +215
   WebApplication4.WebReference.Imainservice.jianpin(String ttjdatasource, String ttshipmentbh, String ttallbh, String ttcargo, 
String ttfactory, String ttbegindate,String ttenddate, String serverpath) +155
   WebApplication4.WebForm1.Button1_Click(Object sender, EventArgs e) +70
   System.Web.UI.WebControls.Button.OnClick(EventArgs e) +9633194
   System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument) +103
   System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) +10
   System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +13
   System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +35
   System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1724

Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.0.30319.34237


解决方法:

在组件服务=》DOCM设置 Microsoft Excel Application的属性里面配置,因为系统分为32位和64位,因此会有不同的处理方法,因为Microsoft Excel Application是32的DCOM配置,所以64位系统的组件服务中DOCOM中默认是没有的。

参考另外一篇在Windows 2008 R2[b]系统中无法看见Microsoft
Excel Application的问题解决方案
[/b][b][b] /article/2448818.html[/b]

[/b]

参考另外一篇配置[b]Mircrosoft Excel Application 相关权限的文章 /article/2448820.html

[/b]

[b]

[/b]

[b][/b]


                                            
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: