"Access Denied" to ICatalogCollection from asp.net web service

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance

From: Ollie (why)
Date: 05/22/04


Date: Sat, 22 May 2004 09:01:09 +0100

I am trying to access the transients subscriptions for a remote COM+ server
from an asp.net web service, the problem is access rights to save to the
local transient subscriptions, the code fails when I attempt to call
'SaveChanges' a System.UnauthorizedAccessException is generated.

So what access rights to I have give to the asp.net process for it to work
or do I have to use impersonation to setup the subscription?

The code is written in C# and OS is Windows 2003 + IIS 6., the code is shown
below....

Cheers in advance

Ollie

static public void Add(string subName,Type eventClass,Type
sinkInterface,string method,object subscriber)
{
   Type sinkType = subscriber.GetType();

   //Verify the interface has that method
   if(method != "")
   {
    MethodInfo info = sinkInterface.GetMethod(method);
    if(info == null)
     return;
   }

   //Adding a new transient subscription to the catalog
   ICOMAdminCatalog catalog;
   ICatalogCollection transientCollection;
   ICatalogObject subscription = null;

   catalog = (ICOMAdminCatalog)new COMAdminCatalog();
   transientCollection =
(ICatalogCollection)catalog.GetCollection("TransientSubscriptions");

   subscription = (ICatalogObject)transientCollection.Add();
   subscription.set_Value("Name",subName);
   subscription.set_Value("SubscriberInterface",subscriber);

   string eventClassString = "{"+eventClass.GUID.ToString()+"}";
   subscription.set_Value("EventCLSID",eventClassString);

   string sinkString = "{" +sinkInterface.GUID.ToString()+ "}";
   subscription.set_Value("InterfaceID",sinkString);

   subscription.set_Value("MethodName",method);
   subscription.set_Value("FilterCriteria","");
   subscription.set_Value("PublisherID","");

    // FAILS HERE
   transientCollection.SaveChanges();
  }



Relevant Pages