我使用Fluent NHibernate 1.2,NH 3.1與castle進行代理生成。我試圖運行應用程序(一個簡單的雙贏的形式應用)作爲一個非管理員用戶,看到了異常: Unable to obtain public key for StrongNameKeyPair.
以前(我不知道我做了什麼來解決這一步),例外是Creating a proxy instance failed.
NHibernate無法通過未經授權的用戶查詢數據庫
從2010年的一些博客文章建議,島城的動態代理可能有中等信任方案的問題,所以我已經盡我運氣sn -m n
但是這似乎並沒有做太多。
有沒有人熟悉這種行爲?
感謝, JK
編輯:
產生這個異常的應用程序調用是在NHibernate的會議一個簡單的LINQ。 這裏的堆棧跟蹤的頂部(整件事〜60線長):
mscorlib.dll!System.Reflection.StrongNameKeyPair.ComputePublicKey() + 0xca bytes
mscorlib.dll!System.Reflection.StrongNameKeyPair.PublicKey.get() + 0x15 bytes
mscorlib.dll!System.Reflection.Emit.AssemblyBuilder.AssemblyBuilder(System.AppDomain domain = {System.AppDomain}, System.Reflection.AssemblyName name = {System.Reflection.AssemblyName}, System.Reflection.Emit.AssemblyBuilderAccess access = Run, string dir = null, System.Security.Policy.Evidence evidence = null, System.Security.PermissionSet requiredPermissions = null, System.Security.PermissionSet optionalPermissions = null, System.Security.PermissionSet refusedPermissions = null, ref System.Threading.StackCrawlMark stackMark = LookForMyCaller, System.Collections.Generic.IEnumerable<System.Reflection.Emit.CustomAttributeBuilder> unsafeAssemblyAttributes = null, System.Security.SecurityContextSource securityContextSource = CurrentAssembly) + 0x4b8 bytes
mscorlib.dll!System.Reflection.Emit.AssemblyBuilder.InternalDefineDynamicAssembly(System.Reflection.AssemblyName name, System.Reflection.Emit.AssemblyBuilderAccess access, string dir, System.Security.Policy.Evidence evidence, System.Security.PermissionSet requiredPermissions, System.Security.PermissionSet optionalPermissions, System.Security.PermissionSet refusedPermissions, ref System.Threading.StackCrawlMark stackMark, System.Collections.Generic.IEnumerable<System.Reflection.Emit.CustomAttributeBuilder> unsafeAssemblyAttributes, System.Security.SecurityContextSource securityContextSource) + 0x7e bytes
mscorlib.dll!System.AppDomain.InternalDefineDynamicAssembly(System.Reflection.AssemblyName name, System.Reflection.Emit.AssemblyBuilderAccess access, string dir, System.Security.Policy.Evidence evidence, System.Security.PermissionSet requiredPermissions, System.Security.PermissionSet optionalPermissions, System.Security.PermissionSet refusedPermissions, ref System.Threading.StackCrawlMark stackMark, System.Collections.Generic.IEnumerable<System.Reflection.Emit.CustomAttributeBuilder> assemblyAttributes, System.Security.SecurityContextSource securityContextSource) + 0x2c bytes
mscorlib.dll!System.AppDomain.DefineDynamicAssembly(System.Reflection.AssemblyName name, System.Reflection.Emit.AssemblyBuilderAccess access) + 0x2b bytes
Castle.Core.dll!Castle.DynamicProxy.ModuleScope.CreateModule(bool signStrongName = true) + 0x1fa bytes
Castle.Core.dll!Castle.DynamicProxy.ModuleScope.ObtainDynamicModuleWithStrongName() + 0x9d bytes
Castle.Core.dll!Castle.DynamicProxy.ModuleScope.ObtainDynamicModule(bool isStrongNamed = true) + 0x2b bytes
Castle.Core.dll!Castle.DynamicProxy.ModuleScope.DefineType(bool inSignedModulePreferably = true, string name = "Castle.Proxies.Invocations.Entity`1_Equals", System.Reflection.TypeAttributes flags = Public | Serializable) + 0x5a bytes
Castle.Core.dll!Castle.DynamicProxy.Generators.Emitters.ClassEmitter.CreateTypeBuilder(Castle.DynamicProxy.ModuleScope modulescope = {Castle.DynamicProxy.ModuleScope}, string name = "Castle.Proxies.Invocations.Entity`1_Equals", System.Type baseType = {Name = "InheritanceInvocation" FullName = "Castle.DynamicProxy.InheritanceInvocation"}, System.Collections.Generic.IEnumerable<System.Type> interfaces = {System.Type[0]}, System.Reflection.TypeAttributes flags = Public | Serializable, bool forceUnsigned = false) + 0x68 bytes