如果我下面的行添加到ASP.NET MVC操作方法與內拋出:SecurityException引發異常僅在ASP.NET MVC顯示內部異常
throw new Exception("outer", new SecurityException("inner"));
那就是死亡的黃色屏幕上實際顯示的錯誤是內部SecurityException,絕對沒有提及外部異常。
SecurityException
Description: The application attempted to perform an operation not allowed by the security policy. To grant this application the required permission please contact your system administrator or change the application's trust level in the configuration file.
Exception Details: System.Security.SecurityException: inner
Source Error:
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.
Stack Trace:
[SecurityException: inner]
這是預期的行爲嗎?
外部異常的類型似乎並不重要。即使它是另一個SecurityException,也不會顯示消息。默認的SecurityException錯誤信息非常模糊,我想抓住它並添加一些更具體的信息。如果我不包含原始的SecurityException作爲innerException,但是理想情況下我想這樣做,這工作正常。
我看到任何內部異常都是如此,而不僅僅是securityexception。 – 2017-10-27 16:30:23