Getting COMException "Could not read key from registry (Exception from HRESULT: 0x80040150 (REGDB_E_READREGDB))" when instantiating WCF service

1628 views
Skip to first unread message

eirik årdal

unread,
Sep 19, 2016, 7:12:20 AM9/19/16
to Castle Project Users
Hi

I just posted this on StackOverflow as well, so if you'd like to answer there, please go ahead. Here is a copy & paste of my issue:

For a project at work we use Castle Windsor as our inversion of control container. In my team's project we depend on another team's WCF web services. The config for consuming these web services are set up in such a way that we will simply constructor inject the necessary interfaces from their library and then Castle Windsor creates and manages the WCF service instance.

This works fine for everyone in my team, except me. It used to work fine for me as well, but a couple of days ago I started getting the below stack trace whenever I hit code that require Castle Windsor to instantiate a WCF service:


Could not read key from registry (Exception from HRESULT: 0x80040150 (REGDB_E_READREGDB)) System.Runtime.InteropServices.COMException (0x80040150): Could not read key from registry (Exception from HRESULT: 0x80040150 (REGDB_E_READREGDB)) at System.Runtime.InteropServices.Marshal.GetObjectForIUnknown(IntPtr pUnk) at System.Runtime.InteropServices.RuntimeEnvironment.GetRuntimeInterfaceAsObject(Guid clsid, Guid riid) at Microsoft.Runtime.Hosting.StrongNameHelpers.get_StrongName() at Microsoft.Runtime.Hosting.StrongNameHelpers.StrongNameGetPublicKey(String pwzKeyContainer, Byte[] bKeyBlob, Int32 cbKeyBlob, IntPtr& ppbPublicKeyBlob, Int32& pcbPublicKeyBlob) 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.BaseProxyGenerator.BuildClassEmitter(String typeName, Type parentType, IEnumerable`1 interfaces) at Castle.DynamicProxy.Generators.ClassProxyGenerator.GenerateType(String name, Type[] interfaces, INamingScope namingScope) at Castle.DynamicProxy.Generators.BaseProxyGenerator.ObtainProxyType(CacheKey cacheKey, Func`3 factory) at Castle.DynamicProxy.ProxyGenerator.CreateClassProxy(Type classToProxy, Type[] additionalInterfacesToProxy, ProxyGenerationOptions options, Object[] constructorArguments, IInterceptor[] interceptors) at Castle.Facilities.WcfIntegration.Async.AsynChannelFactoryBuilder`1.CreateChannelFactory(Type channelFactoryType, M clientModel, Object[] constructorArgs) at Castle.Facilities.WcfIntegration.AbstractChannelBuilder`1.CreateChannelCreator(Type contract, M clientModel, IChannelBuilderScope scope, Object[] channelFactoryArgs) at Castle.Facilities.WcfIntegration.AbstractChannelBuilder`1.Scope.Castle.Facilities.WcfIntegration.IWcfEndpointVisitor.VisitBindingAddressEndpoint(BindingAddressEndpointModel model) at Castle.Facilities.WcfIntegration.AbstractChannelBuilder`1.Scope.BuildChannelCreator() at Castle.Facilities.WcfIntegration.WcfClientActivator.CreateChannelCreator(IKernel kernel, ComponentModel model, IWcfClientModel clientModel, IWcfBurden& burden) at Castle.Facilities.WcfIntegration.WcfClientActivator.GetChannelCreator(CreationContext context, IWcfBurden& burden) at Castle.Facilities.WcfIntegration.WcfClientActivator.Instantiate(CreationContext context) at Castle.MicroKernel.ComponentActivator.DefaultComponentActivator.InternalCreate(CreationContext context) at Castle.MicroKernel.ComponentActivator.AbstractComponentActivator.Create(CreationContext context, Burden burden) at Castle.MicroKernel.Lifestyle.AbstractLifestyleManager.CreateInstance(CreationContext context, Boolean trackedExternally) at Castle.MicroKernel.Lifestyle.ScopedLifestyleManager.<>c__DisplayClass1.<Resolve>b__0(Action`1 afterCreated) at Castle.MicroKernel.Lifestyle.Scoped.DefaultLifetimeScope.GetCachedInstance(ComponentModel model, ScopedInstanceActivationCallback createInstance) at Castle.MicroKernel.Lifestyle.ScopedLifestyleManager.Resolve(CreationContext context, IReleasePolicy releasePolicy) at Castle.MicroKernel.Handlers.DefaultHandler.ResolveCore(CreationContext context, Boolean requiresDecommission, Boolean instanceRequired, Burden& burden) at Castle.MicroKernel.Handlers.DefaultHandler.Resolve(CreationContext context, Boolean instanceRequired) at Castle.MicroKernel.Resolvers.DefaultDependencyResolver.ResolveFromKernelByType(CreationContext context, ComponentModel model, DependencyModel dependency) at Castle.MicroKernel.Resolvers.DefaultDependencyResolver.Resolve(CreationContext context, ISubDependencyResolver contextHandlerResolver, ComponentModel model, DependencyModel dependency) at Castle.MicroKernel.ComponentActivator.DefaultComponentActivator.CreateConstructorArguments(ConstructorCandidate constructor, CreationContext context) at Castle.MicroKernel.ComponentActivator.DefaultComponentActivator.Instantiate(CreationContext context) at Castle.MicroKernel.ComponentActivator.DefaultComponentActivator.InternalCreate(CreationContext context) at Castle.MicroKernel.ComponentActivator.AbstractComponentActivator.Create(CreationContext context, Burden burden) at Castle.MicroKernel.Lifestyle.AbstractLifestyleManager.CreateInstance(CreationContext context, Boolean trackedExternally) at Castle.MicroKernel.Lifestyle.ScopedLifestyleManager.<>c__DisplayClass1.<Resolve>b__0(Action`1 afterCreated) at Castle.MicroKernel.Lifestyle.Scoped.DefaultLifetimeScope.GetCachedInstance(ComponentModel model, ScopedInstanceActivationCallback createInstance) at Castle.MicroKernel.Lifestyle.ScopedLifestyleManager.Resolve(CreationContext context, IReleasePolicy releasePolicy) at Castle.MicroKernel.Handlers.DefaultHandler.ResolveCore(CreationContext context, Boolean requiresDecommission, Boolean instanceRequired, Burden& burden) at Castle.MicroKernel.Handlers.DefaultHandler.Resolve(CreationContext context, Boolean instanceRequired) at Castle.MicroKernel.Resolvers.DefaultDependencyResolver.ResolveFromKernelByType(CreationContext context, ComponentModel model, DependencyModel dependency) at Castle.MicroKernel.Resolvers.DefaultDependencyResolver.Resolve(CreationContext context, ISubDependencyResolver contextHandlerResolver, ComponentModel model, DependencyModel dependency) at Castle.MicroKernel.ComponentActivator.DefaultComponentActivator.CreateConstructorArguments(ConstructorCandidate constructor, CreationContext context) at Castle.MicroKernel.ComponentActivator.DefaultComponentActivator.Instantiate(CreationContext context) at Castle.MicroKernel.ComponentActivator.DefaultComponentActivator.InternalCreate(CreationContext context) at Castle.MicroKernel.ComponentActivator.AbstractComponentActivator.Create(CreationContext context, Burden burden) at Castle.MicroKernel.Lifestyle.AbstractLifestyleManager.CreateInstance(CreationContext context, Boolean trackedExternally) at Castle.MicroKernel.Lifestyle.AbstractLifestyleManager.Resolve(CreationContext context, IReleasePolicy releasePolicy) at Castle.MicroKernel.Handlers.DefaultHandler.ResolveCore(CreationContext context, Boolean requiresDecommission, Boolean instanceRequired, Burden& burden) at Castle.MicroKernel.Handlers.DefaultHandler.Resolve(CreationContext context, Boolean instanceRequired) at Castle.MicroKernel.DefaultKernel.ResolveComponent(IHandler handler, Type service, IDictionary additionalArguments, IReleasePolicy policy) at Castle.MicroKernel.DefaultKernel.Castle.MicroKernel.IKernelInternal.Resolve(Type service, IDictionary arguments, IReleasePolicy policy) at Betaling.Api.Ioc.WindsorWebApiIHttpControllerActivator.Create(HttpRequestMessage request, HttpControllerDescriptor controllerDescriptor, Type controllerType) in <PROJECT PATH REMOVED FOR COPYPASTE>\Ioc\WindsorWebApiIHttpControllerActivator.cs:line 21 at System.Web.Http.Controllers.HttpControllerDescriptor.CreateController(HttpRequestMessage request) at System.Web.Http.Dispatcher.HttpControllerDispatcher.<SendAsync>d__1.MoveNext()


I'm not sure why a call to my machine's registry is necessary, but apparantly there is something extracted from there in order to generate either a public key or get the name of a key. As mentioned, this is only an issue on my computer. The same code (same commits) runs just fine for everyone else on my team and in our dev environments.


Any ideas or tips are welcome at this stage.

Jonathon Rossi

unread,
Sep 19, 2016, 7:26:35 AM9/19/16
to Castle Project Users
I've posted an answer on SO, hope that helps.

--
You received this message because you are subscribed to the Google Groups "Castle Project Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to castle-project-u...@googlegroups.com.
To post to this group, send email to castle-pro...@googlegroups.com.
Visit this group at https://groups.google.com/group/castle-project-users.
For more options, visit https://groups.google.com/d/optout.
Reply all
Reply to author
Forward
0 new messages