2013-05-14 103 views
0

我正在使用Net framework 4.0和Sql Server 2012進行開發。在asp.net中的Web應用程序中執行數據庫操作時會隨機發生錯誤。我已經從代碼隱藏文件中調用了一些sql查詢。它發生在大於300KB的大文件上。如何增加大小。.net框架執行由於內存不足而被升級策略中止

編輯:

它主要發生時查看圖像文件和數據庫

下面保存二進制數據是在那裏我得到錯誤

 int isUpdateIDProof = 1; 
     SqlParameter paramInsertIDProof = null; 
     SqlCommand cmdInsertIDProof = new SqlCommand("OnBoarding_InsertUploadedIDProof", con); 
     cmdInsertIDProof.CommandType = CommandType.StoredProcedure; 

     paramInsertIDProof = new SqlParameter("@FileCaption", SqlDbType.VarChar, 100); 
     paramInsertIDProof.Direction = ParameterDirection.Input; 
     paramInsertIDProof.Value = txtIDProofDescription.Text; 
     cmdInsertIDProof.Parameters.Add(paramInsertIDProof); 

     paramInsertIDProof = new SqlParameter("@FileData", SqlDbType.VarBinary,1000000000); 
     paramInsertIDProof.Direction = ParameterDirection.Input; 
     paramInsertIDProof.Value = OnBoardingFileData; 
     cmdInsertIDProof.Parameters.Add(paramInsertIDProof); 

     paramInsertIDProof = new SqlParameter("@FileNames", SqlDbType.VarChar, 100); 
     paramInsertIDProof.Direction = ParameterDirection.Input; 
     paramInsertIDProof.Value = fileName; 
     cmdInsertIDProof.Parameters.Add(paramInsertIDProof); 

     //execute SQL COMMAND 
     con.Open(); 
     cmdInsertIDProof.ExecuteNonQuery(); 
     con.Close(); 
+0

你可以請張貼一些代碼嗎? 這樣做的最可能的原因可以是: 1)圖像文件\二進制數據實際上是太大 2)你是不是正確處置您的SqlDataReaders \您共享SqlDataReaders \多線程 – 2013-05-14 18:26:43

+0

之間SqlConnections SqlConnections 3)是對於大型文檔 – 2013-05-15 09:48:51

+0

會出現此問題似乎是存儲過程中的問題。你可以發表這個。 – Kitty 2013-05-15 10:19:53

回答

3

代碼沒有任何問題與你的code。它的所有內容都是關於您存儲映像的方式在數據庫服務器上的內存泄漏。如果您使用任何sql server項目DLL來壓縮和解壓縮二進制數據,請檢查這一點。

要隱藏您的錯誤,您可以重新啓動sql server服務。它會自動刷新內存並開始正常工作。幾年前我有同樣的問題。

+0

謝謝科迪。我剛剛重新啓動了服務,並感到驚訝。我的圖片已成功上傳。 – 2013-05-30 07:23:27