Can I use NHibernate on GoDaddy?
A comment from .Net Hosting (Flexible Medium Trust) says.
Godaddy is medium trust, which means that u can't use stuff like IL emit(Nhiber开发者_开发百科nate needs this for proxying)
Is it true? Is there anyone using NHibernate on GoDaddy?
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
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.
Yes you can, try edit web.config file.
<system.web>
<trust level="Full" />
</system.web>
精彩评论