Could not read key from registry (Exception from HRESULT: 0x80040150 (REGDB_E_READREGDB))
<p>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. </p>

<p>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:</p>

<p><code>
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&amp; ppbPublicKeyBlob, Int32&amp; 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&amp; 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&amp; 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&amp; 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&amp; burden)
   at Castle.Facilities.WcfIntegration.WcfClientActivator.GetChannelCreator(CreationContext context, IWcfBurden&amp; 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.&lt;&gt;c__DisplayClass1.&lt;Resolve&gt;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&amp; 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.&lt;&gt;c__DisplayClass1.&lt;Resolve&gt;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&amp; 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&amp; 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 &lt;PROJECT PATH REMOVED FOR COPYPASTE&gt;\Ioc\WindsorWebApiIHttpControllerActivator.cs:line 21
   at System.Web.Http.Controllers.HttpControllerDescriptor.CreateController(HttpRequestMessage request)
   at System.Web.Http.Dispatcher.HttpControllerDispatcher.&lt;SendAsync&gt;d__1.MoveNext()
</code></p>

<p>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.</p>

<p>Any ideas or tips are welcome at this stage.</p>