2011-06-05 39 views
0

我已经将我的asp.net web项目转换为Cloud Service。当我在我的本地机器上编译它时,它工作正常。但是当我将它部署在Windows Azure上,并将其作为* .cloudapp.net运行时,它会显示以下错误。它不会上传或下载任何文件。任何帮助将不胜感激。谢谢!(在'/'应用程序中的服务器错误。无法找到文件)在Windows Azure中的错误

错误:'/'应用程序中的服务器错误。

找不到文件'E:\ approot \ uploads \ 129517348374782571'。

描述:执行当前Web请求期间发生未处理的异常。请查看堆栈跟踪以获取有关该错误的更多信息以及源代码的位置。

异常详细信息:System.IO.FileNotFoundException:无法找到文件'E:\ approot \ uploads \ 129517348374782571'。

源错误:

在当前web请求的执行过程中生成未处理的异常。关于异常的来源和位置的信息可以使用下面的异常堆栈跟踪来标识。

堆栈跟踪:

[FileNotFoundException异常:找不到文件 'E:\为approot \上传\ 129517348374782571'。] System.IO .__ Error.WinIOError(的Int32的errorCode,字符串maybeFullPath)12892807 系统。 IO.FileInfo.get_Length()+12550108 C:\ Users \ canosum \ documents \ visual studio 2010 \ Projects \ EsraSon2 \ EsraSon2 \ CourseList.aspx.cs中的EsraSon2.CourseList.gvPaths_SelectedIndexChanged(Object sender,EventArgs e):78 System.Web.UI.WebControls.GridView.HandleEvent(EventArgs e,Boolean causesValidation,String validationGroup)+1203 System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint,Boolean i ncludeStagesAfterAsyncPoint)3691 `

上传代码:

string temp = DateTime.Now.ToFileTime().ToString(); 
       FileUpload1.PostedFile.SaveAs(Server.MapPath("uploads") +"\\"+ temp); 
       BLLFileUpload m_helper = new BLLFileUpload(); 
       DateTime date = DateTime.Now; 
       m_helper.InsertUploadFiletoDB(temp, FileUpload1.FileName, date, 1, Convert.ToInt32(gvSemesters.SelectedRow.Cells[7].Text)); 

下载代码:

BLLFileUpload m_helper = new BLLFileUpload(); 

      string tempname = m_helper.getFileRealName(gvPaths.SelectedRow.Cells[2].Text); 
      string fName = Server.MapPath("uploads")+ "\\" + tempname; 
      FileInfo fi = new FileInfo(fName); 
      long sz = fi.Length; 

      Response.ClearContent(); 
      Response.AddHeader("Content-Disposition", string.Format("attachment; filename = {0}", gvPaths.SelectedRow.Cells[3].Text)); 
      Response.AddHeader("Content-Length", sz.ToString("F0")); 
      Response.TransmitFile(fName); 
      Response.End(); 

回答

相关问题