在vs2005里面运行正常,发布到iis5.1里面不能导出excel
在vs2005里面运行正常,发布到iis5.1里面不能导出excel。报错如下Can't create file. Is file with the "D:\shiti.xls" name used by another process?
说明: 执行当前 Web 请求期间,出现未处理的异常。请检查堆栈跟踪信息,以了解有关该错误以及代码中导致错误的出处的详细信息。
异常详细信息: System.IO.IOException: Can't create file. Is file with the "D:\shiti.xls" name used by another process?
源错误:
行 286: }
行 287: }
行 288: excelFile.SaveXls("D:\\shiti.xls");
行 289:
行 290: HttpContext.Current.Response.Write(string.Format(js, "导出成功!"));
源文件: e:\exam1\kaoshi\infolist.aspx.cs 行: 288
堆栈跟踪:
[IOException: Can't create file. Is file with the "D:\shiti.xls" name used by another process?]
GemBox.ExcelLite.UnmanagedStorage..ctor(String fileName, Boolean create) in E:\Users\weip\Desktop\temp\GemBox.ExcelLite23_Source\GemBox.ExcelLite\UnmanagedStorage.cs:29
GemBox.ExcelLite.StructuredStorageFileBase.Create(String fileName) in E:\Users\weip\Desktop\temp\GemBox.ExcelLite23_Source\GemBox.ExcelLite\StructuredStorageFileBase.cs:19
GemBox.ExcelLite.ExcelFile.SaveXLSInternal(AbsXLSRecords records, String fileName, Byte[] ss, Byte[] dss) in E:\Users\weip\Desktop\temp\GemBox.ExcelLite23_Source\GemBox.ExcelLite\ExcelFile.cs:726
GemBox.ExcelLite.ExcelFile.SaveXls(String fileName) in E:\Users\weip\Desktop\temp\GemBox.ExcelLite23_Source\GemBox.ExcelLite\ExcelFile.cs:721
gs_infolist.Button2_Click(Object sender, EventArgs e) in e:\exam1\kaoshi\infolist.aspx.cs:288
System.Web.UI.WebControls.Button.OnClick(EventArgs e) +105
System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument) +107
System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) +7
System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +11
System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +33
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +5102 --------------------编程问答-------------------- 这个文件可能是正在被别的进程使用中,
另外,要写成
excelFile.SaveXls(Server.MapPath("~/shiti.xls")); 来计算物理路径 --------------------编程问答-------------------- 没有被任何文件使用
补充:.NET技术 , ASP.NET