Attempt by security transparent method to access security critical method failed

前端 未结 5 1507
遥遥无期
遥遥无期 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: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

提交回复
热议问题