1

We would like to run particular setting value on ContentDelivery or ContentManagement server only in Sitecore 9.1.1.

Config file

<configuration xmlns:patch="http://www.sitecore.net/xmlconfig/">
  <sitecore>
    <services>
      <configurator type="name, assembly name" />    
    </services>
    <settings>
      <setting name="Name" value="web"     require="ContentDelivery" />
      <setting name="Name" value="master" require="ContentManagement"  />
    </settings>
    <mvc>
      <precompilation>
        <assemblies>
          <assemblyIdentity name="project name" />
        </assemblies>
      </precompilation>
    </mvc>
  </sitecore>
</configuration>

We have added require attribute (require="ContentDelivery" ) but it's not working.

1 Answer 1

4

Try this:

<configuration xmlns:patch="http://www.sitecore.net/xmlconfig/" xmlns:role="http://www.sitecore.net/xmlconfig/role/">
  <sitecore>
    <services>
      <configurator type="name, assembly name" />    
    </services>
    <settings>
      <setting name="Name" value="web"     role:require="ContentDelivery" />
      <setting name="Name" value="master" role:require="ContentManagement"  />
    </settings>
    <mvc>
      <precompilation>
        <assemblies>
          <assemblyIdentity name="project name" />
        </assemblies>
      </precompilation>
    </mvc>
  </sitecore>
</configuration>

Note the "role:require" instead of require and the xmlns:role at the top as differences.

6
  • Not able to fetch the value of Name in code in CM server (Local)
    – Ashu
    Commented Oct 14, 2020 at 7:54
  • Is your role set correctly? You should first check the resulting config with /sitecore/admin/showconfig.aspx to make sure that is correct (the issue could be in the code as well).
    – Gatogordo
    Commented Oct 14, 2020 at 8:03
  • In config file, content delivery and content management role are not showing anywhere. Do we need to create these roles in local instance as well if they are not showing?
    – Ashu
    Commented Oct 14, 2020 at 9:40
  • Your local instance is probably a Standalone version. But that is an assumption.. You might want to join us on Slack as I do think you have other issues - or at least show us your role config.
    – Gatogordo
    Commented Oct 14, 2020 at 10:07
  • any link for Slack where I can join ?
    – Ashu
    Commented Oct 14, 2020 at 10:17

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.