5

I am trying to retrive the contact details using Tridion.OutboundEmail.ContentManagement API.

After running below code on Page load of user control I am getting error: Access is denied for the user IIS APPPOOL(pool name)

Detailed Error:

System.ServiceModel.FaultException`1[[Tridion.AudienceManagement.DomainModel.ServiceClient.CoreServiceFault, Tridion.AudienceManagement.DomainModel, Version=2.2.0.742, Culture=neutral, PublicKeyToken=ddfc895746e5ee6b]]: Access is denied for the user IIS APPPOOL(pool name)

public void GetContacts_via_filter()
{
    var uri = new TcmUri(101, 2, TcmItemTypes.StaticAddressBook);
    var addressBook = new StaticAddressBook(uri);
    // Got error on this line "UserContext.Current"
    var filter = new ContactFilter(UserContext.Current);
    var contacts = Contact.GetContacts(filter, addressBook);
    foreach (var contact in contacts) 
    {
        Response.Write(contact.ExtendedDetails["NAME"].StringValue);
    }
}

My Question here is: 1. How can I change the current user (which is IIS Application pool) to Tridion User (say administrator) 2. I tried initializing the User Context object :

  UserContext adminUser = new UserContext("Administartor trustee name");
            // Able to get the adminUser.TcmUri and adminUser.UserName
           // Response.Write("name is" + adminUser.TcmUri);
            var uri = new TcmUri(PublicationID, AddressID, TcmItemTypes.StaticAddressBook);                 
            var addressBook = new StaticAddressBook(uri, adminUser);                
            var filter = new ContactFilter(adminUser);               
            var contacts = addressBook.GetContacts(filter, addressBook);

but now got the same error on line "var contacts = addressBook.GetContacts(filter, addressBook);"

Please help 1. How can I run my code under tridion user credential? or 2.where I need to give the access to user IIS APPPOOL(pool name) to fetch the contact details.

2 Answers 2

7

Follow below steps:

  1. Go to IIS (run inetmgr.exe in command prompt) on your CMS server
  2. Explore the Application Pool section
  3. There must be an App Pool for your website, Select it and Choose the Advance Settings.
  4. Choose Identity section and change the Buil-in account to Network Services as shown below:

Alternatively you can choose to provide your custom account which could be the MTS or Admin User.

enter image description here

EDIT:

Ensure whatever user you choose (Network Service or MTS User or any other), have Read-Write Access to all the relevant Web and application folder including C:\Windows\TEMP etc.

6
  • Now the error changed to Access is denied for the user TRIDIONDEV\DOMIANNAME$.
    – Meenakshi
    Commented May 20, 2013 at 13:14
  • Go to Services.msc and ensure all your Tridion Related services are not running using any unexpected User Name. To be on the safer side configure all your Tridion Related Services to run either by using Network Service user or at max the MTS User Commented May 20, 2013 at 13:31
  • Further Ensure, your MTS user is correct in DCOM+ and its Password is not expired. Please note even if MTS user password is expired and DCOM+ application or Services are not restarted, your CME still keep working. Commented May 20, 2013 at 13:32
  • All the services are running as "Local System Account" under Log on tab. Yes, MTS user is correct in DCOM+. I don't know the password of MTS User but in USer tab (My computer) "password never expire" checkbox is checked for the user. Other then this code everything is running fine. Thanks
    – Meenakshi
    Commented May 20, 2013 at 13:43
  • Can you try running your Tridion Services through Network Service and see if the error still persists? Commented May 20, 2013 at 13:56
4

I got this similar issue with Content porter but solution was Content Porter application's app pool(in my case it was default app pool) was referring ApplicationIdentity account instead of network service. Please check could be same case with this issue.

5
  • Nice timing Raj :) Commented May 20, 2013 at 13:03
  • Now the error changed to Access is denied for the user TRIDIONDEV\DOMIANNAME$.
    – Meenakshi
    Commented May 20, 2013 at 13:13
  • Give this user read-write access to all relevent folders including C:\Windows\Temp. See EDIT in my answer Commented May 20, 2013 at 13:15
  • Can you use Network Service user for your app pool
    – Raj Kumar
    Commented May 20, 2013 at 13:16
  • Yup. I updated the Identity to Network service user and restarted the IIS. Thanks . The new error says it uses user "TRIDIONDEV\DOMIANNAME$" instead of "TRIDIONDEV\USERNAME$". Not sure why it is using domian name of server instead of user name.
    – Meenakshi
    Commented May 20, 2013 at 13:18

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.