OleDbPermission 和 ASP.NET 中等信任
我正在关注此文档,以便在中等信任环境中运行我的网站< /a>.我的网络应用程序使用 OleDb,因此我需要以中等信任度授予它权限。我已经完成了该文章中的所有操作,但它仍然无法正常工作:(
在我的 web_mediumtrust.config 中,我添加了以下安全类:
<SecurityClass Name="OleDbPermission" Description="System.Data.OleDb.OleDbPermission, System.Data, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
和以下权限集:
<PermissionSet class="NamedPermissionSet" version="1" Name="ASP.Net">
<IPermission class="OleDbPermission" version="1" Unrestricted="true" />
</PermissionSet>
但当我尝试使用它时,我仍然遇到异常:
系统.Security.SecurityException 发生消息=“请求 类型许可 '系统.Data.OleDb.OleDbPermission, 系统.数据,版本=2.0.0.0, 文化=中立, 公钥令牌=b77a5c561934e089' 失败。”来源=“mscorlib”
堆栈跟踪: 在 System.Security.CodeAccessSecurityEngine.Check(对象 需求,StackCrawlMark&堆栈标记, 布尔值 isPermSet) 在 System.Security.PermissionSet.Demand() 在 System.Data.Common.DbConnectionOptions.DemandPermission() 在 System.Data.ProviderBase.DbConnectionClosed.OpenConnection(DbConnection 等等等等......
我缺少什么吗?我还需要做其他事情吗?
亲切的问候。
I'm following this document in order to run my website in a medium trust environment. My web app uses OleDb, so I need to give it permission in medium trust. I've done everything that is in that article and it's still not working :(
In my web_mediumtrust.config I've added the following security class:
<SecurityClass Name="OleDbPermission" Description="System.Data.OleDb.OleDbPermission, System.Data, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
And the following permission set:
<PermissionSet class="NamedPermissionSet" version="1" Name="ASP.Net">
<IPermission class="OleDbPermission" version="1" Unrestricted="true" />
</PermissionSet>
But I still get an exception when I try to use it:
System.Security.SecurityException
occurred Message="Request for the
permission of type
'System.Data.OleDb.OleDbPermission,
System.Data, Version=2.0.0.0,
Culture=neutral,
PublicKeyToken=b77a5c561934e089'
failed." Source="mscorlib"
StackTrace:
at System.Security.CodeAccessSecurityEngine.Check(Object
demand, StackCrawlMark& stackMark,
Boolean isPermSet)
at System.Security.PermissionSet.Demand()
at System.Data.Common.DbConnectionOptions.DemandPermission()
at System.Data.ProviderBase.DbConnectionClosed.OpenConnection(DbConnection blah blah blah....
Is there something I'm missing? Do I have to do anything else?
Kind regards.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
有一个 x32: 的配置文件夹
和另一个 x64: 的配置文件夹:
我觉得很愚蠢......
there is a configuration folder for x32:
and another for x64:
I feel such as stupid...