Search code examples
c#iisdllregistrationcom+

Register a .NET DLL with Activate Library mode


I have a couple of .NET classes build to DLL files. I use regsvcs.exe to register them to make them available in COM+ (VBscript) environments.

All those registered components are setup as Activation => Server application. This make this components runs in dllhost.exe.

As I run this in IIS with classic ASP I want to run it as Library applicationas this is 3times faster.

enter image description here

I did not find a option in regsvcs.exe how to set this on registration. So anyone knows how to set this programmatically?


Solution

  • For those who seek this information, as I found it out myself already:

      COMAdminCatalog catalog = new COMAdminCatalog();
      COMAdminCatalogCollection applications = catalog.GetCollection("Applications");
      applications.Populate();
      foreach (COMAdminCatalogObject application in applications)
      {
        // list needs to be extended if more components needs registration
        if (application.Name == "your component name")
        {
          //application.set_Value("Authentication", 2);
          //application.set_Value("Identity", userName);
          //application.set_Value("Password", password);
          application.set_Value("Activation", "Inproc");
        }
      }
      applications.SaveChanges();