Can I use NHibernate on GoDaddy?

百般思念 提交于 2019-11-29 09:27:36

问题


A comment from .Net Hosting (Flexible Medium Trust) says.

Godaddy is medium trust, which means that u can't use stuff like IL emit(Nhibernate needs this for proxying)

Is it true? Is there anyone using NHibernate on GoDaddy?


回答1:


I have successfully run Nhibernate 2.1 and now 3 in a medium trust environment. The only thing I had to do for NH3 was to download Castle source and modify the CommonAssemblyInfo.cs file so that Partially trusted callers is enabled.

You will need to reference the compiled castle dll's into NHibernates source and rebuild. You can reference all the compiled dll's into your project and viola.

[assembly: AllowPartiallyTrustedCallers()]

Everything else works great including proxies.

Additional -> it should be noted that I run this on Rackspace Cloud Medium trust levels and not on Go Daddy but I suspect/hope that it should be the same!

Edit To run nHibernate 3.2 in medium trust environments please see this link or this one




回答2:


There are many questions already on SO dealing with NHibernate + medium trust:

  • nhibernate proxy generator
  • does nhibernate work with medium trust out of the box?
  • NHibernate 2.1.2 in medium trust
  • NHibernate 2 + Fluent Nhibernate medium trust

Bottom line: use a compile-time proxy generator.




回答3:


Yes you can, try edit web.config file.

<system.web>
    <trust level="Full" />
</system.web>


来源:https://stackoverflow.com/questions/4825122/can-i-use-nhibernate-on-godaddy

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!