在 .NET 4 中结合使用旧安全策略和动态操作
我正在尝试一起使用旧的 .NET 代码,该代码需要设置旧的安全策略支持:
<NetFx40_LegacySecurityPolicy enabled="true" />
并且还托管 IronPython(并且可能在某些地方使用 dynamic
关键字)。
我找不到同时使用它们的方法。如果我将上述选项添加到 app.config
文件中,则会出现异常
动态操作只能是 在同质 AppDomain 中执行。
如果我不添加该选项,我会得到
此方法显式使用 CAS 策略,该策略已被 .NET Framework 废弃。为了出于兼容性原因启用 CAS 策略,请使用 NetFx40_LegacySecurityPolicy 配置开关。请参阅http://go.microsoft.com/fwlink/?LinkID=155570了解更多信息。
有什么办法可以解决这个问题吗?
I'm trying to use together an old .NET code that requires setting the legacy security policy support:
<NetFx40_LegacySecurityPolicy enabled="true" />
and also hosting IronPython (and maybe using the dynamic
keyword at some places).
I can't find a way to use them both together. If I add the above option to the app.config
file, I get an exception
Dynamic operations can only be
performed in homogenous AppDomain.
If I don't add that option, I get
This method explicitly uses CAS policy, which has been obsoleted by the .NET Framework. In order to enable CAS policy for compatibility reasons, please use the NetFx40_LegacySecurityPolicy configuration switch. Please see http://go.microsoft.com/fwlink/?LinkID=155570 for more information.
Is there any way to work around this problem?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
值得一试,不要设置 LegacySerurityPolicy 并尝试为您的应用程序提供应用程序清单,而不是类似于以下内容。
Worth the shot, do not set The LegacySerurityPolicy and try to provide an application manifest for your APP instead similar to the following.