怎样才能修复"'System.Security.Permissions.SecurityAction.RequestMinimum“已过时"编译错误? [英] How does one fix the "'System.Security.Permissions.SecurityAction.RequestMinimum' is obsolete" compilation error?

查看:2460
本文介绍了怎样才能修复"'System.Security.Permissions.SecurityAction.RequestMinimum“已过时"编译错误?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我收到以下编译警告作为一个错误,而从.NET 3.5升级一些ASP.NET code:
System.Security.Permissions.SecurityAction.RequestMinimum'已经过时了。

I received the following compilation warning as a error while upgrading some ASP.NET code from .NET 3.5: 'System.Security.Permissions.SecurityAction.RequestMinimum' is obsolete.

属性已申请在assebly水平蜜蜂:

The attribute has bee applied on the assebly level:

[assembly: System.Security.Permissions.SecurityPermission(System.Security.Permissions.SecurityAction.RequestMinimum, Execution=true)]

另外,code使用了P&放大器,P的Web客户端软件工厂,特异性地将ObjectBuilder.WCSFExtensions库。
此外,它的code是提供了一些角色提供的实现。

Also the code makes use of the P&P Web Client Software Factory, specificly the ObjectBuilder.WCSFExtensions library. Also it the code is providing some role provider implementations.

请记住,这code被用作其他项目框架code,所以很难确定哪些安全需求有可能是。

Keep in mind this code is used as Framework code in other projects, so it is hard to determine what security demands there might be.

所以,畅想DOLAR问题是:

So the milion dolar question is:

需要什么值被用于System.Security.Permissions.SecurityAction枚举

What value needs to be used for the "System.Security.Permissions.SecurityAction" enum?

或者是有没有应用这种安全属性更好的办法?

Alternatively is there a better approach to applying the this security attribute?

推荐答案

你阅读完整的编译器警告或访问它包含的链接? 裸CLR将不再限制CAS权限下.NET 4.0,除非你翻车了传统模式开关,所以没有更换您的RequestMinimum使用。该汇编级SecurityPermissionAttribute应该被删除,不能修改。

Did you read the full compiler warning or visit the link it includes? The "naked" CLR no longer restricts CAS permissions under .NET 4.0 unless you flip a "legacy mode" switch, so there is no replacement for your RequestMinimum use. The assembly-level SecurityPermissionAttribute should be removed, not modified.

有关比出现在MSDN上的4.0 CAS的变化更完整的说明,请参阅http://blogs.msdn.com/b/shawnfa/archive/2009/05/21/security-policy-in-the-v4-clr.aspx和<一个href=\"http://blogs.msdn.com/b/shawnfa/archive/2010/02/24/so-is-cas-dead-in-net-4-or-what.aspx\">http://blogs.msdn.com/b/shawnfa/archive/2010/02/24/so-is-cas-dead-in-net-4-or-what.aspx.

For a more complete explanation of the 4.0 CAS changes than appears on MSDN, see http://blogs.msdn.com/b/shawnfa/archive/2009/05/21/security-policy-in-the-v4-clr.aspx and http://blogs.msdn.com/b/shawnfa/archive/2010/02/24/so-is-cas-dead-in-net-4-or-what.aspx.

这篇关于怎样才能修复&QUOT;'System.Security.Permissions.SecurityAction.RequestMinimum“已过时&QUOT;编译错误?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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