我正在本地運行IIS上的ASP.NET項目,並且在處理回發後異常報告回到Web瀏覽器。爲什麼我的服務器端異常不會導致我的代碼在VS2010中中斷?
在VS2010中,如果我查看Debug-> Exceptions ...,每個異常類型都會在引發時檢查是否中斷。
這裏是我看到在我的瀏覽器彈出窗口中的例外:
Line: 868 Error: Sys.WebForms.PageRequestManagerServerErrorException: Input string was not in a correct format.
這裏的響應返回給我從提琴手得到了瀏覽器:
41|error|500|Input string was not in a correct format.|
當然我一派,而大部分職位說試圖將一個字符串解析爲一個int可能會導致這種情況。我不認爲我在做那樣的事情。
======編輯=======
刪除的UpdatePanel,現在我得到:
[FormatException: Input string was not in a correct format.]
System.Number.StringToNumber(String str, NumberStyles options, NumberBuffer& number, NumberFormatInfo info, Boolean parseDecimal) +12630469
System.Number.ParseInt32(String s, NumberStyles style, NumberFormatInfo info) +224
System.Web.UI.WebControls.GridView.HandleEvent(EventArgs e, Boolean causesValidation, String validationGroup) +483
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +3691
=============== ==
感謝, 馬克
[PageRequestManager](http://msdn.microsoft.com/en-us/library/bb311028.aspx)類是客戶端API的一部分,所以它在客戶端嘗試訪問時顯示錯誤解析響應中返回的內容。如果你發佈更多的代碼並接受更多的答案,我相信你會得到一個解決方案。 – Town 2011-04-25 19:13:01
我發佈了上面的響應(這是一個例外),客戶端解析並顯示它就好了。這實際上與代碼無關,還有更多與我一起試圖弄清楚爲什麼VS不會中斷,即使它看起來像是在服務器上拋出異常。 – MStodd 2011-04-25 19:38:10
您使用更新面板嗎?嘗試將[EnablePartialRendering](http://msdn.microsoft.com/zh-cn/library/system.web.ui.scriptmanager.enablepartialrendering.aspx)設置爲false或刪除更新面板,然後您應該看到例外之後。 – Town 2011-04-25 19:47:54