locked
COM+ Registration issue RRS feed

  • Question

  • I have a custom asp.net control that makes a call to a simple class which apparently triggers the system to try to install this class as a COM+ component. This class used to inherit from ServicedComponent, but I removed this part. It is a simple .net class now. Here is the error I found in the event log:

    Log Name:      Application
    Source:        ExceptionManagerPublishedException
    Date:          3/3/2015 8:44:35 AM
    Event ID:      0
    Task Category: None
    Level:         Error
    Keywords:      Classic
    User:          N/A
    Computer:      MyServer
    Description:
    
    
    1) Exception Information
    *********************************************
    Exception Type: System.EnterpriseServices.RegistrationException
    ErrorInfo: NULL
    Message: You must have administrative credentials to perform this task. Contact your system administrator for assistance.
    Data: System.Collections.ListDictionaryInternal
    TargetSite: Void InstallAssembly(System.EnterpriseServices.RegistrationConfig, System.Object)
    HelpLink: NULL
    Source: System.EnterpriseServices
    HResult: -2146233087
    
    StackTrace Information
    *********************************************
       at System.EnterpriseServices.RegistrationDriver.InstallAssembly(RegistrationConfig regConfig, Object obSync)
       at System.EnterpriseServices.RegistrationHelper.InstallAssemblyFromConfig(RegistrationConfig& regConfig)
       at System.EnterpriseServices.RegistrationHelper.InstallAssembly(String assembly, String& application, String partition, String& tlb, InstallationFlags installFlags)
       at System.EnterpriseServices.RegistrationHelper.InstallAssembly(String assembly, String& application, String& tlb, InstallationFlags installFlags)
       at System.EnterpriseServices.RegistrationHelper.System.EnterpriseServices.Thunk.IThunkInstallation.DefaultInstall(String asm)
       at System.EnterpriseServices.Thunk.Proxy.RegisterAssembly(Assembly assembly)
       at System.EnterpriseServices.Thunk.Proxy.LazyRegister(Guid id, Type serverType, Boolean checkCache)
       at System.EnterpriseServices.Thunk.Proxy.CoCreateObject(Type serverType, Boolean bQuerySCInfo, Boolean& bIsAnotherProcess, String& uri)
       at System.EnterpriseServices.ServicedComponentProxyAttribute.CreateInstance(Type serverType)
       at System.Runtime.Remoting.Activation.ActivationServices.IsCurrentContextOK(RuntimeType serverType, Object[] props, Boolean bNewObj)
       at MyNamespace.MyCustomControl.SetImage()
       at MyNamespace.MyCustomControl.set_ImageID(Nullable`1 value)
       at MyNamespace.MyCustomControl.CreateChildControls()
    
    2) Exception Information
    *********************************************
    Exception Type: System.EnterpriseServices.RegistrationException
    ErrorInfo: NULL
    Message: Failed to register assembly 'MyAssemblyName, Version=1.0.0.0, Culture=neutral, PublicKeyToken=*'.
    Data: System.Collections.ListDictionaryInternal
    TargetSite: Void ClassicRegistration(System.Reflection.Assembly)
    HelpLink: NULL
    Source: System.EnterpriseServices
    HResult: -2146233087
    
    StackTrace Information
    *********************************************
       at System.EnterpriseServices.RegistrationDriver.ClassicRegistration(Assembly asm)
       at System.EnterpriseServices.RegistrationDriver.InstallAssembly(RegistrationConfig regConfig, Object obSync)
    
    3) Exception Information
    *********************************************
    Exception Type: System.UnauthorizedAccessException
    Message: Access to the registry key 'HKEY_CLASSES_ROOT\MyassemblyName' is denied.
    Data: System.Collections.ListDictionaryInternal
    TargetSite: Void Win32Error(Int32, System.String)
    HelpLink: NULL
    Source: mscorlib
    HResult: -2147024891
    
    StackTrace Information
    *********************************************
       at Microsoft.Win32.RegistryKey.Win32Error(Int32 errorCode, String str)
       at Microsoft.Win32.RegistryKey.CreateSubKeyInternal(String subkey, RegistryKeyPermissionCheck permissionCheck, Object registrySecurityObj, RegistryOptions registryOptions)
       at Microsoft.Win32.RegistryKey.CreateSubKey(String subkey, RegistryKeyPermissionCheck permissionCheck)
       at System.Runtime.InteropServices.RegistrationServices.RegisterManagedType(Type type, String strAsmName, String strAsmVersion, String strAsmCodeBase, String strRuntimeVersion)
       at System.Runtime.InteropServices.RegistrationServices.RegisterAssembly(Assembly assembly, AssemblyRegistrationFlags flags)
       at System.EnterpriseServices.RegistrationDriver.ClassicRegistration(Assembly asm)
    Event Xml:
    <Event xmlns="http://schemas.microsoft.com/win/2004/08/events/event">
      <System>
        <Provider Name="ExceptionManagerPublishedException" />
        <EventID Qualifiers="0">0</EventID>
        <Level>2</Level>
        <Task>0</Task>
        <Keywords>0x80000000000000</Keywords>
        <TimeCreated SystemTime="2015-03-03T15:44:35.000000000Z" />
        <EventRecordID>78338</EventRecordID>
        <Channel>Application</Channel>
        <Computer>MyServer</Computer>
        <Security />
      </System>
      <EventData>
        <Data>
    
    1) Exception Information
    *********************************************
    Exception Type: System.EnterpriseServices.RegistrationException
    ErrorInfo: NULL
    Message: You must have administrative credentials to perform this task. Contact your system administrator for assistance.
    Data: System.Collections.ListDictionaryInternal
    TargetSite: Void InstallAssembly(System.EnterpriseServices.RegistrationConfig, System.Object)
    HelpLink: NULL
    Source: System.EnterpriseServices
    HResult: -2146233087
    
    StackTrace Information
    *********************************************
       at System.EnterpriseServices.RegistrationDriver.InstallAssembly(RegistrationConfig regConfig, Object obSync)
       at System.EnterpriseServices.RegistrationHelper.InstallAssemblyFromConfig(RegistrationConfig&amp; regConfig)
       at System.EnterpriseServices.RegistrationHelper.InstallAssembly(String assembly, String&amp; application, String partition, String&amp; tlb, InstallationFlags installFlags)
       at System.EnterpriseServices.RegistrationHelper.InstallAssembly(String assembly, String&amp; application, String&amp; tlb, InstallationFlags installFlags)
       at System.EnterpriseServices.RegistrationHelper.System.EnterpriseServices.Thunk.IThunkInstallation.DefaultInstall(String asm)
       at System.EnterpriseServices.Thunk.Proxy.RegisterAssembly(Assembly assembly)
       at System.EnterpriseServices.Thunk.Proxy.LazyRegister(Guid id, Type serverType, Boolean checkCache)
       at System.EnterpriseServices.Thunk.Proxy.CoCreateObject(Type serverType, Boolean bQuerySCInfo, Boolean&amp; bIsAnotherProcess, String&amp; uri)
       at System.EnterpriseServices.ServicedComponentProxyAttribute.CreateInstance(Type serverType)
       at System.Runtime.Remoting.Activation.ActivationServices.IsCurrentContextOK(RuntimeType serverType, Object[] props, Boolean bNewObj)
       at MyNamespace.MyCustomControl.SetImage()
       at MyNamespace.MyCustomControl.set_ImageID(Nullable`1 value)
       at MyNamespace.MyCustomControl.CreateChildControls()
    
    2) Exception Information
    *********************************************
    Exception Type: System.EnterpriseServices.RegistrationException
    ErrorInfo: NULL
    Message: Failed to register assembly 'MyAssemblyName, Version=1.0.0.0, Culture=neutral, PublicKeyToken=*'.
    Data: System.Collections.ListDictionaryInternal
    TargetSite: Void ClassicRegistration(System.Reflection.Assembly)
    HelpLink: NULL
    Source: System.EnterpriseServices
    HResult: -2146233087
    
    StackTrace Information
    *********************************************
       at System.EnterpriseServices.RegistrationDriver.ClassicRegistration(Assembly asm)
       at System.EnterpriseServices.RegistrationDriver.InstallAssembly(RegistrationConfig regConfig, Object obSync)
    
    3) Exception Information
    *********************************************
    Exception Type: System.UnauthorizedAccessException
    Message: Access to the registry key 'HKEY_CLASSES_ROOT\MyAssemblyName' is denied.
    Data: System.Collections.ListDictionaryInternal
    TargetSite: Void Win32Error(Int32, System.String)
    HelpLink: NULL
    Source: mscorlib
    HResult: -2147024891
    
    StackTrace Information
    *********************************************
       at Microsoft.Win32.RegistryKey.Win32Error(Int32 errorCode, String str)
       at Microsoft.Win32.RegistryKey.CreateSubKeyInternal(String subkey, RegistryKeyPermissionCheck permissionCheck, Object registrySecurityObj, RegistryOptions registryOptions)
       at Microsoft.Win32.RegistryKey.CreateSubKey(String subkey, RegistryKeyPermissionCheck permissionCheck)
       at System.Runtime.InteropServices.RegistrationServices.RegisterManagedType(Type type, String strAsmName, String strAsmVersion, String strAsmCodeBase, String strRuntimeVersion)
       at System.Runtime.InteropServices.RegistrationServices.RegisterAssembly(Assembly assembly, AssemblyRegistrationFlags flags)
       at System.EnterpriseServices.RegistrationDriver.ClassicRegistration(Assembly asm)</Data>
      </EventData>
    </Event>

    Please let me know what other information I can provide.

    Any help is appreciated.


    Wednesday, March 4, 2015 6:22 PM

Answers

  • Turns out that there was another class that inherited ServicedComponent that I missed before. Was sure I looked through all of them. Silly mistake. After removing the inheritance it started working.
    • Marked as answer by Fred Bao Monday, March 16, 2015 11:50 AM
    Friday, March 6, 2015 5:54 PM

All replies

  • How does .NET runtime decide whether to register a class as a COM+ component?

    Wednesday, March 4, 2015 10:33 PM
  • Hello cyxapebpek,

    As far as I know, there are two ways we could use to register an assembly(it does not target the class, it targets the project the class belongs to for example, a class library project.):

    One is to use the Regasm.exe (Assembly Registration Tool), this way is manual and is not registered by the .NET runtime.

    Another is to use the Visual Studio, there is option to register your assembly with COM Interop in Project Properties (Right click on project and choose properties), go to Build tab, there is an option for "Register for COM Interop". (Basically what it does is, it calls regasm after DLL is built!):

    From your description, I am wondering if this option of the assembly the class belongs to is checked. If so, please uncheck it. Or if you want to register it as a COM interop, then you need to run the Visual Studio with the administrator.

    Regards,

    Fred.


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Thursday, March 5, 2015 7:11 AM
  • Fred, thank you for your reply. I verified the 'Register for COM Interop' option is unchecked. It must be something else.
    Thursday, March 5, 2015 3:47 PM
  • So from what I understand, looking at the stack trace, .NET runtime tries to dynamically register my class library as a COM+ application in Component Services. So I'd like to understand what is it about my class library that makes .NET think that it needs to do that. I guess at build time instead of using regular object binding it creates ComponentServicesProxy objects that perform COM+ Interop. Why it does that I don't know.
    Thursday, March 5, 2015 7:48 PM
  • Hello,

    >> So I'd like to understand what is it about my class library that makes .NET think that it needs to do that

    My suggestion is that(maybe it is clumpy) you could comment some of your code and run app until you find the caused code.

    Regards.


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Friday, March 6, 2015 10:15 AM
  • Turns out that there was another class that inherited ServicedComponent that I missed before. Was sure I looked through all of them. Silly mistake. After removing the inheritance it started working.
    • Marked as answer by Fred Bao Monday, March 16, 2015 11:50 AM
    Friday, March 6, 2015 5:54 PM