2010-11-08 17 views
0

在我們的開發環境系統上工作正常,但在Live系統上有時buttonClick動作會產生以下錯誤。如果我按下1-2次它的工作原理而不會產生錯誤。繼續收到「對象引用未設置爲對象的實例」。

在實時系統錯誤,它仍然顯示我的本地路徑。這可能是問題嗎? 感謝您的幫助

Object reference not set to an instance of an object. 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.

異常詳細信息:

System.NullReferenceException: Object reference not set to an instance of an object.

源錯誤:

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.

堆棧跟蹤:

[NullReferenceException: Object reference not set to an instance of an object.] WebApplication4.orderConfirmation.SubmitButton_Click(Object sender, EventArgs e) in C:\Documents and Settings\Desktop\Purchase\WebApplication4\WebApplication4\orderConfirmation.aspx.cs:341 System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument) +153 System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +3690

+0

您是否介意發佈'SubmitButton_Click'的代碼並指出'orderConfirmation.aspx.cs'中的第341行是哪一行? – 2010-11-08 10:52:57

+1

請詳細說明縮小錯誤的時間。有了這幾個信息,有無盡的可能原因。 順便說一句,你是本地路徑被添加,因爲它最後被編譯爲本地機器上的調試,並且您已將此.pdb文件複製到服務器,但這不會導致異常。 – 2010-11-08 10:56:22

回答

1

要回答一個問題:將.NET代碼編譯到DLL中時,源文件的本地路徑正在存儲在程序集中 - 不確定是否只在Debug或Release中進行編譯。

無論如何,生成.PDB文件添加到包含服務器上的DLL文件相同的文件夾,你還可以得到行號(而不是神祕的3690):具有這個你可以找出造成這個錯誤的確切行..在這裏發佈此信息,我們將能夠提供幫助。

+0

.PDB文件已經在與DLL相同的文件夾中。 – EnginBodur 2010-11-10 09:50:52

+0

因此,只有當EXE在Debug模式下編譯時,它纔會顯示確切的行。嘗試編譯在調試模式,並希望你會有行號.. – 2010-11-10 11:29:46

+0

@EnginBodur標記這是正確的手段你有行號,並自己解決這個問題,或者你仍然需要幫助? – 2010-11-15 17:34:28

0

看起來你可能會遇到頁面生命週期錯誤,你可能會在某個點設置一個變量,並期望當你訪問該變量時該變量不爲null。

相關問題