异常详细信息:System.Security.SecurityException:请求失败

时间:2020-03-14 12:29:28

标签: asp.net configuration web-config securityexception .net-4.7.2

我已经在服务器上部署了一个网站(Windows主机)。

我遇到以下错误:

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 failed.

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.

我搜索并发现解决方案是将以下代码添加到webconfig文件中

<trust level="Full"/>

但这会产生错误

Configuration Error
Description: An error occurred during the processing of a configuration file required to service this request. Please review the specific error details below and modify your configuration file appropriately.

Parser Error Message: This configuration section cannot be used at this path.  This happens when the site administrator has locked access to this section using <location allowOverride="false"> from an inherited configuration file.

Source Error:


An application error occurred on the server. The current custom error settings for this application prevent the details of the application error from being viewed remotely (for security reasons). It could, however, be viewed by browsers running on the local server machine.

Line: 24

webconfig文件中的第24行

<trust level="Full"/>

如何解决这个问题?

我正在使用 目标框架:.NET Framework 4.7.2

修改

您可以检查代码访问安全性是否已设置为完整

enter image description here

0 个答案:

没有答案