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

2016-09-19 Thread Jonathon Rossi
I've posted an answer on SO, hope that helps.

On Mon, Sep 19, 2016 at 9:12 PM eirik årdal  wrote:

> 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

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

2016-09-19 Thread eirik årdal
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.Compo