nhibernate を使用する Web サイトがあり、共有 Web ホストでホストされています。
「NHibernate.Cfg.Environment.UseReflectionOptimizer = false;」で遅延読み込みを無効にしました。私のホストではリフレクションが許可されていないためです。
しかし今、私はnhibernateに別の問題があります:
Security Exception
Description: The application attempted to perform an operation not allowed by the security policy. To grant this application the required permission please contact your system administrator or change the application's trust level in the configuration file.
Exception Details: System.Security.SecurityException: Request failed.
Source Error:
An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.
Stack Trace:
[SecurityException: Request failed.]
System.Security.CodeAccessSecurityEngine.ThrowSecurityException(RuntimeAssembly asm, PermissionSet granted, PermissionSet refused, RuntimeMethodHandleInternal rmh, SecurityAction action, Object demand, IPermission permThatFailed) +168
System.Security.CodeAccessSecurityEngine.ThrowSecurityException(Object assemblyOrString, PermissionSet granted, PermissionSet refused, RuntimeMethodHandleInternal rmh, SecurityAction action, Object demand, IPermission permThatFailed) +100
System.Security.CodeAccessSecurityEngine.CheckSetHelper(PermissionSet grants, PermissionSet refused, PermissionSet demands, RuntimeMethodHandleInternal rmh, Object assemblyOrString, SecurityAction action, Boolean throwException) +278
System.Security.PermissionSetTriple.CheckSetDemand(PermissionSet demandSet, PermissionSet& alteredDemandset, RuntimeMethodHandleInternal rmh) +69
System.Security.PermissionListSet.CheckSetDemand(PermissionSet pset, RuntimeMethodHandleInternal rmh) +156
System.Security.PermissionListSet.DemandFlagsOrGrantSet(Int32 flags, PermissionSet grantSet) +33
System.Security.CodeAccessSecurityEngine.ReflectionTargetDemandHelper(Int32 permission, PermissionSet targetGrant, CompressedStack securityContext) +128
System.Security.CodeAccessSecurityEngine.ReflectionTargetDemandHelper(Int32 permission, PermissionSet targetGrant) +54
このエラーは、nhibernate が (データベース アクセスのために) 使用されるたびに発生しました。Nhibernate を 1.2 にダウングレードしたところ、マッピング ファイルでリレーションが宣言されているオブジェクトの更新操作と削除操作に対してのみ例外がスローされるようになりました。
エラーは Castle.DynamicProxy.dll が原因だと思います。しかし、プロキシを完全に無効にするにはどうすればよいでしょうか? のマッピングにすべてのオブジェクトと関係を設定しlazy="false"
ました。設定しましたdefault-lazy="false"
nhibernateヘルパーでも設定NHibernate.Cfg.Environment.BytecodeProvider = null;
しましたが、これは役に立ちません。
これは、私のホストの信頼設定を詳述した URL ですhttp://onlinehelp.hostbasket.com/shared-webhosting/scripting/asp-aspnet/1147-why-does-hostbasket-not-support-my-site-in-full -trust.html