试图通过安全透明的方法来访问安全的关键方法失败 [英] Attempt by security transparent method to access security critical method failed

查看:1998
本文介绍了试图通过安全透明的方法来访问安全的关键方法失败的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

尝试通过安全透明的方法'PayPal.UserAgentHeader.get_OperatingSystemFriendlyName()来访问安全至关重要法System.Management.ManagementObjectSearcher..ctor(System.String)'失败。

Assembly 'PayPalCoreSDK, Version=1.4.1.0, Culture=neutral, PublicKeyToken=null' is partially trusted, which causes the CLR to make it entirely security transparent regardless of any transparency annotations in the assembly itself.  In order to access security critical code, this assembly must be fully trusted.

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.MethodAccessException: Attempt by security transparent method 'PayPal.UserAgentHeader.get_OperatingSystemFriendlyName()' to access security critical method 'System.Management.ManagementObjectSearcher..ctor(System.String)' failed.

Assembly 'PayPalCoreSDK, Version=1.4.1.0, Culture=neutral, PublicKeyToken=null' is partially trusted, which causes the CLR to make it entirely security transparent regardless of any transparency annotations in the assembly itself.  In order to access security critical code, this assembly must be fully trusted.

<一个href=\"http://stackoverflow.com/questions/6550890/attempt-by-security-transparent-method-kigg-web-jqueryscriptmanager-oninit\">This计算器答案提到加入 [SecuritySafeCritical] 属性的类,但在这种情况下,在剧中类是通过的NuGet加载的DLL。

This stackoverflow answer mentions adding the [SecuritySafeCritical] attribute to the class, but in this case the class at play is in a DLL loaded through NuGet.

是否有任何全局设置,我可以用它来绕过这个例外?

Are there any global settings I can use to bypass this exception?

推荐答案

下面的代码添加到您的web.config:

Add the following tag to your web.config:

<configuration>
    <system.web>
       <trust level="Full" />
    </system.web>
</configuration>

这是您的托管服务的服务器可能是设置具有中等信任级别。在'PayPalCoreSDK'是要求应用程序具有完全信任级别运行。

The servers on your hosting service is probably setup with a medium trust level. The 'PayPalCoreSDK' is requires your application to run with a full trust level.

这篇关于试图通过安全透明的方法来访问安全的关键方法失败的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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