Attempt by security transparent method to access security critical method failed

前端 未结 5 1442
遥遥无期
遥遥无期 2021-01-12 07:04

Attempt by security transparent method \'PayPal.UserAgentHeader.get_OperatingSystemFriendlyName()\' to access security critical method \'System.Management.Management

相关标签:
5条回答
  • 2021-01-12 07:12

    After upgrading wpftoolkit 3.5 framework to 4.6.1 framework, the below Security rules in assemblyinfo.cs resolve the issue:

    // added because of security transparency change in framework 4.0
    [assembly: SecurityRules(SecurityRuleSet.Level1)]
    
    0 讨论(0)
  • 2021-01-12 07:18

    Add the following tag to your web.config:

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

    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.

    0 讨论(0)
  • 2021-01-12 07:23

    In my case it was an issue when I managed a NuGet packages in the solution some package overrides System.Web.Mvc assembly version binding in main web site project. Set back to 4.0.0.0 (I had 5.0 installed). I didn't change notice the change because Mvc v4.0 was installed and accessible via GAC. Set back

    0 讨论(0)
  • 2021-01-12 07:30

    adding this to assemblyinfo.cs

    // added because of security transparency change in framework 4.0
    [assembly: SecurityRules(SecurityRuleSet.Level1)]
    

    this did the job for me ....

    0 讨论(0)
  • 2021-01-12 07:32

    I was working on a brownfield application with a lot of referenced projects in the solution. One project was set to .NET 4.0 instead of 4.6.1 and I thought that might be it, but that wasn't the issue. I had to add:

     [assembly:AllowPartiallyTrustedCallers]
    

    to the assembly.cs file in the project containing the "security critical" method, and it wasn't happy with me until I also added

    using System.Security;
    

    That did the trick.

    Joey

    0 讨论(0)
提交回复
热议问题