Nếu tôi thêm các dòng sau vào một phương pháp hành động ASP.NET MVCNém ngoại lệ với SecurityException bên trong chỉ hiển thị ngoại lệ bên trong ASP.NET MVC
throw new Exception("outer", new SecurityException("inner"));
lỗi mà là thực sự hiển thị trên màn hình màu vàng của cái chết là SecurityException bên trong hoàn toàn không đề cập đến ngoại lệ bên ngoài.
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]
Hành vi này có được mong đợi không?
Dường như ngoại lệ ngoại lệ là gì. Ngay cả khi nó là một SecurityException khác, tin nhắn không bao giờ được hiển thị. Thông báo lỗi SecurityException mặc định quá mơ hồ đến nỗi tôi muốn bắt nó và thêm một số thông tin cụ thể hơn. Điều này làm việc tốt nếu tôi không bao gồm SecurityException gốc là innerException nhưng lý tưởng là tôi muốn làm điều này.
Tôi thấy điều này đúng với bất kỳ ngoại lệ bên trong nào, không chỉ là sự an toàn. –