Castle ActiveRecord - 在中等信任度下启用延迟加载
我有一个在中等信任服务器中运行的 MVC3 应用程序,该应用程序使用 Castle ActiveRecord,但如果我启用延迟加载,则会向我显示黄色屏幕安全异常。如果我禁用延迟加载,一切都会正常。
有没有办法在带有 Castle.Core 版本 3 和 nHibernate 3.1.0.4000 的中等信任服务器中使用延迟加载?
对不起我的英语,谢谢。
更新:
在 Google 搜索中,我发现了以下选项:
预生成延迟加载代理
http://nhforge.org/wikis/howtonh/pre-generate-lazy-loading-proxies.aspx
我尝试过,但看起来像这样不适用于 Caste.Core 3 和 nHibernate 3.1。我错了?
看起来这个选项很长时间没有收到更新,这很糟糕。
中等信任度下的新冒险
http://blogs.taiga.nl/martijn/2009/06/24/new-adventures-under-medium-trust/
在 Castle DynamicProxy 主题中,我发现:
“解决方案很简单:DynamicProxy 调用 AssemblyBuilder.DefineDynamicModule 并使用生成调试符号的重载。将其更改为不再生成调试符号使其在中等信任下工作!”
我开源了 Castle.Core,并在 ModuleScope.cs (Castle.Core\DynamicProxy) 中找到了 AssemblyBuilder.DefineDynamicModule,并在调用中将其设置为 false 以生成调试符号。
I have a MVC3 application running in a Medium Trust Server, that use Castle ActiveRecord, but if I enable the Lazy Loading, a yellow sreen Security Exception is showed to me. If I disable the Lazy Loading, everything works.
There is a way to use Lazy Loading in a Medium Trust Server with Castle.Core version 3 and nHibernate 3.1.0.4000?
Sorry for my english and thanks.
Update:
In my searches on Google, I found this options:
Pre-Generate Lazy Loading Proxies
http://nhforge.org/wikis/howtonh/pre-generate-lazy-loading-proxies.aspx
I tried, but looks like that don't work with Caste.Core 3 and nHibernate 3.1. I'm wrong?
Looks like this option dont receive updates for a long time and this is bad.
New adventures under medium trust
http://blogs.taiga.nl/martijn/2009/06/24/new-adventures-under-medium-trust/
In Castle DynamicProxy topic, I found:
"The solution was a simple one: DynamicProxy calls AssemblyBuilder.DefineDynamicModule and used the overload that generates debug symbols. Changing that to not generate the debug symbols anymore made it work under medium trust!"
I open source of Castle.Core and I found AssemblyBuilder.DefineDynamicModule in ModuleScope.cs (Castle.Core\DynamicProxy), and in calls its already set false to generate debug symbols.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
当我遇到类似的问题时,我必须下载城堡源代码并设置AllowPartiallyTrustedCallers,然后重新编译。
我希望它有帮助。
When I had a similar problem I had to download the castle source and set
AllowPartiallyTrustedCallers
and then recompiled.I hope it helps.