c# - 了解网络服务器上的 LinkDemand 安全性

标签 c# asp.net security permissions

在网络服务器上部署 ASP.Net 应用程序后,我通过使用来自外部程序集的代码收到此错误消息:“LinkDemand The type of first permission that failed was: System.Security.PermissionSet The Zone of the assembly that that失败是:MyComputer 错误“。

程序集包含在\bin 文件夹中,而不是在 GAC 中。

我想知道 linkdemand 到底是什么以及为什么会出现此消息。但是在寻找更多信息时,我并没有完全明白问题所在。

我还尝试在发生异常消息的类上添加 PermissionSetAttribute:

 [System.Security.Permissions.PermissionSetAttribute(System.Security.Permissions.SecurityAction.LinkDemand, Name = "FullTrust")]

然后将在程序集的另一个类上引发异常。等等..

我的问题是:

  • 这里究竟出了什么问题? Jit 无法检查代码安全性时,我所理解的这个错误信息是真的吗?

  • 是否有可能阻止此 (machine.config) 或直接更改安全性的安全策略?

  • 我可以为程序集之间的所有类设置 PermissionAttribute 吗?

最佳答案

转到管理工具和本地安全策略。虽然,我不知道您收到错误的确切原因,但基本上您是在尝试执行当前安全策略中不允许的代码。检查您的路径和安全策略以及模块的权限要求。默认情况下,某些路径(例如桌面)将以降低的安全性运行。

关于c# - 了解网络服务器上的 LinkDemand 安全性,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2757689/

相关文章:

c# - 如何播放放置在 Resources 文件夹中的 SWF 文件

asp.net - 重新编译asp.net网站时如何重新启动IIS站点

c# - 使用 Environment.Is64BitProcess 从 c# 应用程序动态调用 32 位或 64 位 DLL

c# - process.start() 参数

java - 多态性和接口(interface) - 澄清?

c# - 如何通过颜色选择器更改 Asp.net 中页面的背景颜色

c# - 如何创建全局变量并使其可用于 ASP.NET MVC 5 框架中的所有 View ?

sql-server - NV32ts 及其 SQL 注入(inject)攻击想要做什么?

c# - UWP - 跨设备数据加密

php - 上传 PDF 或 .doc 和安全