程序集不允许部分受信任的调用者 [英] Assembly does not allow partially trusted caller

查看:22
本文介绍了程序集不允许部分受信任的调用者的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何更改我的库以允许部分受信任的呼叫者?

How do I change my library to allow partially trusted callers?

我收到以下错误:

/"应用程序中的服务器错误.

Server Error in '/' Application.

安全异常

描述:应用程序尝试执行不允许的操作安全政策.授予这个申请所需的权限请联系您的系统管理员或更改应用程序的信任级别配置文件.

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.

异常详情:System.Security.SecurityException:该程序集不允许部分值得信赖的来电者.

Exception Details: System.Security.SecurityException: That assembly does not allow partially trusted callers.

来源错误:[无相关来源行]

Source Error: [No relevant source lines]

源文件:App_Web_kzj7vfkn.2.cs
行:0

Source File: App_Web_kzj7vfkn.2.cs
Line: 0

编辑

进一步查看问题后,似乎是 System.Web.UI.ClientScriptManager 导致了问题

Edit

After some more looking at the problem it seems like it's System.Web.UI.ClientScriptManager that causes the problem

推荐答案

假设您可以访问库的源.

Assuming you have access to the sources of your library.

  • Give the library you are trying to call a strong name.
  • Add [assembly:AllowPartiallyTrustedCallers] to the library that you are trying to call.
  • Create a code group to set permissions to the library

此处给出了非常好的详细解释,同时阅读底部的链接以获取更好的理解.

A pretty good and detailed explanation is given here Also read the links at the bottom to get a better understanding.

有可能不是您的程序集是问题所在,而是您正在调用另一个不允许部分受信任调用者的程序集.在运行时,您可以使用 fuslogvw 来查找哪个大会给你带来了问题.如果这是问题所在并且您拥有此程序集的来源,则您还需要应用 [assembly:AllowPartiallyTrustedCallers] 属性到该程序集,如果您没有源,我知道的唯一选择是替换麻烦的库.

There is a possibility that not your assembly is the problem but you are calling another assembly that does not allow partially trusted callers. At runtime you can use fuslogvw to find which assembly is giving you the problems. If this is the problem and you have the sources of this assembly you need to also apply the [assembly:AllowPartiallyTrustedCallers] attribute to that assembly, if you don't have the sources the only option I know of is to replace the troublesome library.

这篇关于程序集不允许部分受信任的调用者的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆