I thought the castle proxy issue was fixed with NH3? We are running into this issue in our test environment. NH 3 Castle core, monorail, windsor 2.5 automapper my project targets .net 4.0
With 2.1 I used LinFu for proxies because Castle was throwing this error. With 3.0 I replaced LinFu with Castle to reduce the number of dependencies. The system runs fine locally and I can access the test environment and not get this error. However my non-admin users are getting a blank page, or no feedback from an ajax call, when a proxy call is attempted. The servers are on my companies intranet. AFAIK we are using the default trust settings. Nobody has adjusted them. I am using NH 3.0 and castle proxies on a webforms project to use lazy properties and that system is running without errors. How can I confirm the trust settings are set to FULL on the web server? As a last resort I could switch back to LinFu, but I would prefer to use a single proxy library if possible. here is the stack trace 2011-01-07 16:17:27,436 [9] ERROR NHibernate.ByteCode.Castle.ProxyFactory [(null)] - Creating a proxy instance failed System.ArgumentException: Unable to obtain public key for StrongNameKeyPair. at System.Reflection.StrongNameKeyPair.ComputePublicKey() at System.Reflection.StrongNameKeyPair.get_PublicKey() at System.Reflection.Emit.AssemblyBuilder..ctor(AppDomain domain, AssemblyName name, AssemblyBuilderAccess access, String dir, Evidence evidence, PermissionSet requiredPermissions, PermissionSet optionalPermissions, PermissionSet refusedPermissions, StackCrawlMark& stackMark, IEnumerable`1 unsafeAssemblyAttributes, SecurityContextSource securityContextSource) at System.Reflection.Emit.AssemblyBuilder.InternalDefineDynamicAssembly(AssemblyName name, AssemblyBuilderAccess access, String dir, Evidence evidence, PermissionSet requiredPermissions, PermissionSet optionalPermissions, PermissionSet refusedPermissions, StackCrawlMark& stackMark, IEnumerable`1 unsafeAssemblyAttributes, SecurityContextSource securityContextSource) at System.AppDomain.InternalDefineDynamicAssembly(AssemblyName name, AssemblyBuilderAccess access, String dir, Evidence evidence, PermissionSet requiredPermissions, PermissionSet optionalPermissions, PermissionSet refusedPermissions, StackCrawlMark& stackMark, IEnumerable`1 assemblyAttributes, SecurityContextSource securityContextSource) at System.AppDomain.DefineDynamicAssembly(AssemblyName name, AssemblyBuilderAccess access) at Castle.DynamicProxy.ModuleScope.CreateModule(Boolean signStrongName) at Castle.DynamicProxy.ModuleScope.ObtainDynamicModuleWithStrongName() at Castle.DynamicProxy.ModuleScope.DefineType(Boolean inSignedModulePreferably, String name, TypeAttributes flags) at Castle.DynamicProxy.Generators.Emitters.ClassEmitter..ctor(ModuleScope modulescope, String name, Type baseType, IEnumerable`1 interfaces, TypeAttributes flags, Boolean forceUnsigned) at Castle.DynamicProxy.Generators.InvocationTypeGenerator.GetEmitter(ClassEmitter class, Type[] interfaces, INamingScope namingScope, MethodInfo methodInfo) at Castle.DynamicProxy.Generators.InvocationTypeGenerator.Generate(ClassEmitter class, ProxyGenerationOptions options, INamingScope namingScope) at Castle.DynamicProxy.Contributors.ClassProxyTargetContributor.BuildInvocationType(MetaMethod method, ClassEmitter class, ProxyGenerationOptions options) at Castle.DynamicProxy.Contributors.ClassProxyTargetContributor.GetMethodGenerator(MetaMethod method, ClassEmitter class, ProxyGenerationOptions options, OverrideMethodDelegate overrideMethod) at Castle.DynamicProxy.Contributors.CompositeTypeContributor.ImplementMethod(MetaMethod method, ClassEmitter class, ProxyGenerationOptions options, OverrideMethodDelegate overrideMethod) at Castle.DynamicProxy.Contributors.CompositeTypeContributor.Generate(ClassEmitter class, ProxyGenerationOptions options) at Castle.DynamicProxy.Generators.ClassProxyGenerator.GenerateType(String name, Type[] interfaces, INamingScope namingScope) at Castle.DynamicProxy.Generators.ClassProxyGenerator.<>c__DisplayClass1.<GenerateCode>b__0(String n, INamingScope s) at Castle.DynamicProxy.Generators.BaseProxyGenerator.ObtainProxyType(CacheKey cacheKey, Func`3 factory) at Castle.DynamicProxy.Generators.ClassProxyGenerator.GenerateCode(Type[] interfaces, ProxyGenerationOptions options) at Castle.DynamicProxy.DefaultProxyBuilder.CreateClassProxyType(Type classToProxy, Type[] additionalInterfacesToProxy, ProxyGenerationOptions options) at Castle.DynamicProxy.ProxyGenerator.CreateClassProxy(Type classToProxy, Type[] additionalInterfacesToProxy, ProxyGenerationOptions options, Object[] constructorArguments, IInterceptor[] interceptors) at NHibernate.ByteCode.Castle.ProxyFactory.GetProxy(Object id, ISessionImplementor session) 2011-01-07 16:17:27,529 [9] ERROR MacolaDbaseConnector.Web.Controllers.GeneralRescueController [(null)] - Trying to map System.Collections.Generic.IEnumerable`1[[MacolaDbaseConnector.Domain.Location, MacolaDbaseConnector.Domain, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null]] to MacolaDbaseConnector.Web.Model.LocationLookup[]. Exception of type 'AutoMapper.AutoMapperMappingException' was thrown. AutoMapper.AutoMapperMappingException: Trying to map System.Collections.Generic.IEnumerable`1[[MacolaDbaseConnector.Domain.Location, MacolaDbaseConnector.Domain, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null]] to MacolaDbaseConnector.Web.Model.LocationLookup[]. Exception of type 'AutoMapper.AutoMapperMappingException' was thrown. ---> NHibernate.HibernateException: Creating a proxy instance failed ---> System.ArgumentException: Unable to obtain public key for StrongNameKeyPair. at System.Reflection.StrongNameKeyPair.ComputePublicKey() at System.Reflection.StrongNameKeyPair.get_PublicKey() at System.Reflection.Emit.AssemblyBuilder..ctor(AppDomain domain, AssemblyName name, AssemblyBuilderAccess access, String dir, Evidence evidence, PermissionSet requiredPermissions, PermissionSet optionalPermissions, PermissionSet refusedPermissions, StackCrawlMark& stackMark, IEnumerable`1 unsafeAssemblyAttributes, SecurityContextSource securityContextSource) at System.Reflection.Emit.AssemblyBuilder.InternalDefineDynamicAssembly(AssemblyName name, AssemblyBuilderAccess access, String dir, Evidence evidence, PermissionSet requiredPermissions, PermissionSet optionalPermissions, PermissionSet refusedPermissions, StackCrawlMark& stackMark, IEnumerable`1 unsafeAssemblyAttributes, SecurityContextSource securityContextSource) at System.AppDomain.InternalDefineDynamicAssembly(AssemblyName name, AssemblyBuilderAccess access, String dir, Evidence evidence, PermissionSet requiredPermissions, PermissionSet optionalPermissions, PermissionSet refusedPermissions, StackCrawlMark& stackMark, IEnumerable`1 assemblyAttributes, SecurityContextSource securityContextSource) at System.AppDomain.DefineDynamicAssembly(AssemblyName name, AssemblyBuilderAccess access) at Castle.DynamicProxy.ModuleScope.CreateModule(Boolean signStrongName) at Castle.DynamicProxy.ModuleScope.ObtainDynamicModuleWithStrongName() at Castle.DynamicProxy.ModuleScope.DefineType(Boolean inSignedModulePreferably, String name, TypeAttributes flags) at Castle.DynamicProxy.Generators.Emitters.ClassEmitter..ctor(ModuleScope modulescope, String name, Type baseType, IEnumerable`1 interfaces, TypeAttributes flags, Boolean forceUnsigned) at Castle.DynamicProxy.Generators.InvocationTypeGenerator.GetEmitter(ClassEmitter class, Type[] interfaces, INamingScope namingScope, MethodInfo methodInfo) at Castle.DynamicProxy.Generators.InvocationTypeGenerator.Generate(ClassEmitter class, ProxyGenerationOptions options, INamingScope namingScope) at Castle.DynamicProxy.Contributors.ClassProxyTargetContributor.BuildInvocationType(MetaMethod method, ClassEmitter class, ProxyGenerationOptions options) at Castle.DynamicProxy.Contributors.ClassProxyTargetContributor.GetMethodGenerator(MetaMethod method, ClassEmitter class, ProxyGenerationOptions options, OverrideMethodDelegate overrideMethod) at Castle.DynamicProxy.Contributors.CompositeTypeContributor.ImplementMethod(MetaMethod method, ClassEmitter class, ProxyGenerationOptions options, OverrideMethodDelegate overrideMethod) at Castle.DynamicProxy.Contributors.CompositeTypeContributor.Generate(ClassEmitter class, ProxyGenerationOptions options) at Castle.DynamicProxy.Generators.ClassProxyGenerator.GenerateType(String name, Type[] interfaces, INamingScope namingScope) at Castle.DynamicProxy.Generators.ClassProxyGenerator.<>c__DisplayClass1.<GenerateCode>b__0(String n, INamingScope s) at Castle.DynamicProxy.Generators.BaseProxyGenerator.ObtainProxyType(CacheKey cacheKey, Func`3 factory) at Castle.DynamicProxy.Generators.ClassProxyGenerator.GenerateCode(Type[] interfaces, ProxyGenerationOptions options) at Castle.DynamicProxy.DefaultProxyBuilder.CreateClassProxyType(Type classToProxy, Type[] additionalInterfacesToProxy, ProxyGenerationOptions options) at Castle.DynamicProxy.ProxyGenerator.CreateClassProxy(Type classToProxy, Type[] additionalInterfacesToProxy, ProxyGenerationOptions options, Object[] constructorArguments, IInterceptor[] interceptors) at NHibernate.ByteCode.Castle.ProxyFactory.GetProxy(Object id, ISessionImplementor session) --- End of inner exception stack trace --- at NHibernate.ByteCode.Castle.ProxyFactory.GetProxy(Object id, ISessionImplementor session) at NHibernate.Tuple.Entity.AbstractEntityTuplizer.CreateProxy(Object id, ISessionImplementor session) at NHibernate.Persister.Entity.AbstractEntityPersister.CreateProxy(Object id, ISessionImplementor session) at NHibernate.Event.Default.DefaultLoadEventListener.CreateProxyIfNecessary(LoadEvent event, IEntityPersister persister, EntityKey keyToLoad, LoadType options, IPersistenceContext persistenceContext) at NHibernate.Event.Default.DefaultLoadEventListener.ProxyOrLoad(LoadEvent event, IEntityPersister persister, EntityKey keyToLoad, LoadType options) at NHibernate.Event.Default.DefaultLoadEventListener.OnLoad(LoadEvent event, LoadType loadType) at NHibernate.Impl.SessionImpl.FireLoad(LoadEvent event, LoadType loadType) at NHibernate.Impl.SessionImpl.InternalLoad(String entityName, Object id, Boolean eager, Boolean isNullable) at NHibernate.Type.EntityType.ResolveIdentifier(Object id, ISessionImplementor session) at NHibernate.Type.EntityType.ResolveIdentifier(Object value, ISessionImplementor session, Object owner) at NHibernate.Engine.TwoPhaseLoad.InitializeEntity(Object entity, Boolean readOnly, ISessionImplementor session, PreLoadEvent preLoadEvent, PostLoadEvent postLoadEvent) at NHibernate.Loader.Loader.InitializeEntitiesAndCollections(IList hydratedObjects, Object resultSetId, ISessionImplementor session, Boolean readOnly) at NHibernate.Impl.MultiCriteriaImpl.GetResultsFromDatabase(IList results) at NHibernate.Impl.MultiCriteriaImpl.DoList() at NHibernate.Impl.MultiCriteriaImpl.ListIgnoreQueryCache() at NHibernate.Impl.MultiCriteriaImpl.List() at NHibernate.Impl.FutureCriteriaBatch.GetResultsFrom(IMultiCriteria multiApproach) at NHibernate.Impl.FutureBatch`2.GetResults() at NHibernate.Impl.FutureBatch`2.get_Results() at NHibernate.Impl.FutureBatch`2.GetCurrentResult[TResult](Int32 currentIndex) at NHibernate.Impl.FutureBatch`2.<>c__DisplayClass4`1.<GetEnumerator>b__3() at NHibernate.Impl.DelayedEnumerator`1.<get_Enumerable>d__0.MoveNext() at System.Linq.Enumerable.Count[TSource](IEnumerable`1 source) at AutoMapper.Mappers.EnumerableMapperBase`1.Map(ResolutionContext context, IMappingEngineRunner mapper) at AutoMapper.MappingEngine.AutoMapper.IMappingEngineRunner.Map(ResolutionContext context) --- End of inner exception stack trace --- at AutoMapper.MappingEngine.AutoMapper.IMappingEngineRunner.Map(ResolutionContext context) at AutoMapper.MappingEngine.Map(Object source, Type sourceType, Type destinationType) at AutoMapper.MappingEngine.Map[TSource,TDestination](TSource source) at MacolaDbaseConnector.Web.Controllers.FinishedGoodsController.Index(DateTime date) -- You received this message because you are subscribed to the Google Groups "nhusers" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/nhusers?hl=en.
