簡體   English   中英

(“/”應用程序中的服務器錯誤。找不到文件)Windows Azure 中的錯誤

[英](Server Error in '/' Application. Could not find file )error in Windows Azure

我已將我的 asp.net web 項目轉換為雲服務。 當我在本地機器上編譯它時,它工作正常。 但是當我將它部署在 Windows Azure 上,並以 *.cloudapp.net 運行時,它顯示以下錯誤。 它不會上傳或下載任何文件。 任何幫助將不勝感激。 謝謝!

錯誤: “/”應用程序中的“服務器錯誤”。

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

說明:在執行當前 web 請求期間發生未處理的異常。 請查看堆棧跟蹤以獲取有關錯誤及其源自代碼的位置的更多信息。

異常詳細信息:System.IO.FileNotFoundException:找不到文件“E:\approot\uploads\129517348374782571”。

源錯誤:

當前 web 請求的執行過程中產生了一個未處理的異常。 可以使用下面的異常堆棧跟蹤來識別有關異常起源和位置的信息。

堆棧跟蹤:

[FileNotFoundException: Could not find file 'E:\approot\uploads\129517348374782571'.] System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath) +12892807 System.IO.FileInfo.get_Length() +12550108 EsraSon2.CourseList. gvPaths_SelectedIndexChanged(Object sender, EventArgs e) in C:\Users\canosum\documents\visual studio 2010\Projects\EsraSon2\EsraSon2\CourseList.aspx.cs:78 System.Web.UI.WebControls.GridView.HandleEvent(EventArgs e, Boolean causesValidation, String validationGroup) +1203 System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +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();

根據您運行的實例數量,無法保證文件已上傳到您嘗試下載的同一台機器,因為有多個服務器。

您需要保留的所有內容,例如上傳的文件應該 go 到 blob 存儲。

這是一個示例(對於大文件)

http://social.msdn.microsoft.com/Forums/en/windowsazure/thread/687b2252-8b5e-473d-b522-ebb6b02693b7

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM