【发布时间】:2013-12-13 16:29:18
【问题描述】:
尝试通过安全透明方法“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.
This stackoverflow answer 提到将[SecuritySafeCritical] 属性添加到类中,但在这种情况下,起作用的类位于通过 NuGet 加载的 DLL 中。
是否有任何全局设置可以用来绕过此异常?
【问题讨论】: