title: COM+ activation on a remote server with partitions in C#
body: <p>I want to access partitioned COM+ applications on a remote server. 
  I have tried this:</p>
  
  <pre><code>using COMAdmin
  using System.Runtime.InteropServices;
  
  _serverName = myRemoteServer;
  _partionName = myPartionName;
  _message = myMessage;
  ICOMAdminCatalog2 catalog = new COMAdminCatalog();
          catalog.Connect(_serverName);
          string moniker = string.Empty;
          string MsgInClassId = "E3BD1489-30DD-4380-856A-12B959502BFD";
  
          //we are using partitions
          if (!string.IsNullOrEmpty(_partitionName))
          {
              COMAdminCatalogCollection partitions = catalog.GetCollection("Partitions");
              partitions.Populate();
              string partitionId = string.Empty;
  
  
              foreach (ICatalogObject item in partitions)
              {
                  if (item.Name == _partitionName)
                  {
                      partitionId = item.Key;
                      break;
                  }
              }
              if (!string.IsNullOrEmpty(partitionId) )
              {
                  moniker = $"partition:{partitionId}/new:{new Guid(MsgInClassId)}";
                  try
                  {
                      var M = (IMsgInManager)Marshal.BindToMoniker(moniker);
                      M.AddMsg(_message);
                  }
                  catch (Exception ex)
                  {
  
                      throw new Exception($"We can not use: {_partitionName} with Id {partitionId}. {ex.ToString()}");
                  }                
              }
              else
              {
                  throw;
              }
          }
          else
  //we don't have partitions and this will work
              {
                  Type T = Type.GetTypeFromCLSID(new Guid(MsgInClassId), _serverName, true);
                  var M = (IMsgInManager)Activator.CreateInstance(T);
                  M.AddMsg(_message);
              }
  
          }
  </code></pre>
  
  <p>So when we are local on the (remote) machine, partitions are working with the moniker and Marshal.BindToMoniker.
  But when I try do the same remotely from my machine, I get an error from
  Marshal.BindToMoniker that Partitons is not enabled. Because on my machine partitions is not enabled.</p>
  
  <pre><code>Message = "COM+ partitions are currently disabled. (Exception from HRESULT: 0x80110824)"
  </code></pre>
  
  <p>How can I use Marshal.BindToMoniker to run on the remote server.
  Is it something I can add to the moniker string i.e.</p>
  
  <pre><code>moniker = $"server:_server/partition:{partitionId}/new:{new Guid(MsgInClassId)}"
  </code></pre>
  
  <p>My questions is very simular to this:
  <a href="https://stackoverflow.com/questions/8916865/com-object-activation-in-a-different-partition">COM+ object activation in a different partition</a> </p>