gpt4 book ai didi

asp.net - 如何跟踪 ASP.NET 安全异常

转载 作者:行者123 更新时间:2023-12-04 07:11:28 25 4
gpt4 key购买 nike

我怎样才能找出导致以下错误的实际原因?该页面与其他页面相同,但由于某种原因,只有该页面出现此错误。它也只发生在信任级别为 Medium 的 ISP (GoDaddy) 上,我无法设置断点并 try catch 它。

Server Error in '/' Application.
Security Exception
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: Request for the permission of type 'System.Security.Permissions.EnvironmentPermission, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' failed.

源错误:
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: Request for the permission of type 'System.Security.Permissions.EnvironmentPermission, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' failed.]       System.Security.CodeAccessSecurityEngine.Check(Object demand, StackCrawlMark& stackMark, Boolean isPermSet) +0       System.Security.CodeAccessPermission.Demand() +59       System.IO.Path.GetTempPath() +54       hh.a(Int32 A_0, Boolean A_1, Boolean A_2) +20       jg.b(c A_0, UInt64 A_1) +234       ei.b(c A_0, UInt64 A_1) +18       jg.a(c A_0, UInt64 A_1, Boolean A_2) +61    
Version Information: Microsoft .NET Framework Version:2.0.50727.1433; ASP.NET Version:2.0.50727.1433

如果您遇到过这个问题或只知道我如何修复或跟踪它,请添加您的答案。 ISP 要求中等信任级别。

最佳答案

您是否尝试过使用 IIS 的本地实例并将信任级别设置为中等?这将帮助您更快地进行调试和尝试。

(无论如何,这是一个好习惯。您希望在尽可能接近生产的环境中进行测试。如果您不在 IIS 中进行测试,VS Web 服务器肯定也有一些重要的差异。 )

关于asp.net - 如何跟踪 ASP.NET 安全异常,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/273803/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com