Microsoft Dynamics 365 Blog

 

When setting up AX 2012 Enterprise Portal (EP) in a multi-server web farm, then setting up AppFabric caching is required. This is for caching session info.

When installing SharePoint 2013 it is recommended to use the prerequisite installer to install AppFabric, ref https://technet.microsoft.com/library/jj219572(office.15).aspx section “Plan for the Distributed Cache service”.

Note: If you are using custom applications (DAX Enterprise Portal is a custom SharePoint application) in SharePoint Server 2013 which use the AppFabric client APIs, or are creating custom caches, you should create a separate AppFabric cache cluster to support your custom applications. Do not use the AppFabric cache cluster supporting your SharePoint Server 2013 farm. Run your separate AppFabric cache cluster for your custom applications on separate servers from the servers dedicated to your SharePoint Server 2013 farm.

 

Recommended setup:

Install SharePoint 2013 (with prerequisite install of AppFabric) on the web servers in the farm.

Note: If you want to have a high availability cache cluster then you need at least 3 cache servers. Ref: https://msdn.microsoft.com/en-us/library/ee790974(v=azure.10).aspx

 

Install and configure AppFabric cache on separate servers (cache cluster not running SharePoint), see https://technet.microsoft.com/en-us/library/dn473937.aspx section “Install and configure Windows Server AppFabric in a cluster”. This blog post is complementary and correction to the setup guide.

 

In my example I have used 6 servers:

1 Domain controller with SQL Server, AOS, SharePoint 2013 with Central Admin running and EP.

2 Web Frontend servers with SharePoint 2013 and EP.

3 AppFabric Cache servers.

 

In section “Run Setup”:

In step 1. Download AppFabric 1.1 and run the WindowsServerAppFabricSetup_x64.exe file on the host server in the cluster.

Continue with step 2-4 in the setup guide.

In step 5. Select Caching Services and Cache Administration and uncheck the other options (Cache Client will run on the web servers).

Continue with step 6-9 in the setup guide.

 

In the section “Run the configuration wizard”:

After setting Configuring Caching service parameters then click Configure on SQL Server AppFabric Caching Service Configuration Store Provider.

Click Ok, Yes and Ok.

Click Next in Configure Caching Service.

 

Configure AppFabric Cache Node:

Click Finish and Yes.

 

Continue with “Configure additional servers in the AppFabric cluster”:

When installing AppFabric on the additional servers, then do the same as in section “Run Setup” above.

 

In the section “Run the configuration wizard”:

 

 

In Configure AppFabric Cache Node select same options as specified for the cache host server above.

 

After AppFabric installation and configuration, I recommend to run Windows update and restart the cache servers.

 

In the section “Configure the cluster cache settings with PowerShell”:

  1. Open PowerShell from Start Menu, click All Programs, Windows Server AppFabric, and then right click Caching Administration Windows PowerShell and select Run as administrator.
  2. Execute the Use-CacheCluster command to set the context of your PowerShell session to a particular cache cluster.
  3. Execute the Get-CacheHost command without parameters to check if the cache service is running on all cache hosts.
    If the cache services are not running
  4. Execute the New-Cache command to create a new named cache. Make a note of the name you specified. You will enter this cache name in the next procedure. Set the -Secondaries parameter to 1 to enable the high availability feature.
  5. Execute the Grant-CacheAllowedClientAccount command and specify the .NET Business Connector proxy (the account that is used by the Enterprise Portal application pool – in my example the Administrator). You can use Get-CacheAllowedClientAccounts to check that the account has been granted permissions.
  6. Export the configuration with this command: Export-CacheClusterConfig and specify a name for the file.
    Example: Export-CacheClusterConfig -File C:\Temp\EPCacheConfig.txt
  7. Open the file (in e.g. Notepad) that you just created and add the following configuration to the <advancedProperties> section and save the file:
    <transportProperties maxBufferSize=”1000000000″ />

  8. Execute the Stop-CacheCluster command to stop the cache.
  9. Import the configuration with this command: Import-CacheClusterConfig and specify the configuration file you just changed.
    Example: Import-CacheClusterConfig -File C:\Temp\EPCacheConfig.txt
  10. Execute the Start-CacheCluster command to start all the cache services in the cache cluster.

 

Next: Install EP in the web farm using host header, see https://blogs.msdn.microsoft.com/axsupport/2015/11/09/how-to-install-ax-2012-enterprise-portal-in-a-multi-server-web-farm/

 

If you already have a web server running EP on a web application that was not created with host header and you want to add more web servers to the farm, then you need to create a new web application using host header and then install EP on that web application.

 

On the EP servers you now need to configure the AppFabric caching, section “Install and configure the cache client” in the AppFabric setup guide.

Note: Do not install the cache client as this is already installed by the SharePoint prerequisite installer, but start from step 4.

If the CA server should not be acting as WFE, then stop the web application service on the CA server (SharePoint Central Administration > System Settings > Manage services on this server).

 

On each of the WFE’s (cache clients) do the following:

  1. In Windows explorer, open the C:\inetpub\wwwroot\wss\VirtualDirectories\<EPsite> folder. Ex: C:\inetpub\wwwroot\wss\VirtualDirectories\EP.contoso.com80
    Locate the web.config file and create a backup of this file in a different location.
  2. Open the web.config file in e.g. Notepad.
  3. Locate the <configSections>. Add the following section tag before the <sectionGroup name=”Microsoft.Dynamics”> tag:

    <section name=”dataCacheClient” type=”Microsoft.ApplicationServer.Caching.DataCacheClientSection, Microsoft.ApplicationServer.Caching.Core, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35″ allowLocation=”true” allowDefinition=”Everywhere” />

    If these tags does not already exist in the web.config file, then you need to add it:

    <sectionGroup name=”Microsoft.Dynamics”>
    <section name=”Session” type=”Microsoft.Dynamics.Framework.BusinessConnector.Configuration.SessionConfigurationSection, Microsoft.Dynamics.Framework.BusinessConnector, Version=6.3.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35″ />
    <section name=”ServerState” type=”Microsoft.Dynamics.Framework.Portal.Configuration.ServerStateConfigurationSection, Microsoft.Dynamics.Framework.Portal, Version=6.3.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35″ />
    <section name=”AppFabricCaching” type=”Microsoft.Dynamics.Framework.Portal.Configuration.AppFabricConfigurationSection, Microsoft.Dynamics.Framework.Portal, Version=6.3.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35″ />
    </sectionGroup>

    Note: if you are running AX 2012 R2, then the version numbers in the above sections must be 6.2.0.0

  4. Add the following dataCacheClient tag to the web.config file after the </configSections>. Replace each instance of “Host_server_name” with the name of a cache server. Replace “default” with the name specified when you executed the New-Cache command.

    <dataCacheClient>
    <localCache isEnabled=”false” />
    <hosts>
    <!–List of hosts –>
    <host name=” Host_server_name1″ cachePort=”22233″ />
    <host name=” Host_server_name2″ cachePort=”22233″ />
    <host name=” Host_server_name3″ cachePort=”22233″ />
    </hosts>
    </dataCacheClient>
    <Microsoft.Dynamics>
    <ServerState Enabled=”true” />
    <AppFabricCaching CacheName=”default” />
    </Microsoft.Dynamics>

    Note:
    If the AppFabric Caching Service (Control Panel > System and Security > Administrative Tools > Services) running on the cache servers is running under a domain account, then you need to add dataCacheServiceAccountType=”DomainAccount” to the dataCacheClient tag, ref: http://blogs.msdn.com/b/distributedservices/archive/2012/10/29/authenticationexception-in-appfabric-1-1-caching-for-windows-server.aspx

    Example (AppFabric Caching Service running under “Network Service”):

 

Use the following procedure to validate that the AppFabric cache stores Enterprise Portal session on the server:

  1. On all the AppFabric servers, verify in the Windows Services console that AppFabric Caching Service is running.
  2. On one of the cache servers open PowerShell from Start Menu, click All Programs, Windows Server AppFabric, and then right click Caching Administration Windows PowerShell and select Run as administrator.
  3. Execute the Use-CacheCluster command and then the Get-CacheStatistics command and specify the name used for the EP cache. The results should display all zeros.
  4. Open Enterprise Portal and open some edit pages.
  5. Execute the Get-CacheStatistics command again and specify the name used for the EP cache. Verify that the cache displays values. This indicates that cache distribution is working.

 

 

Setup in test systems:

Install SharePoint 2013 (with prerequisite install of AppFabric) on the web servers in the farm.

In this example I have used 3 web servers, 1 running SharePoint Central Administration (CA) and 2 Web Frontend (WFE).

Note: If you want to have a high availability cache cluster then you need at least 3 cache servers. Ref: https://msdn.microsoft.com/en-us/library/ee790974(v=azure.10).aspx

 

When installing SharePoint 2013 in the web farm, then SharePoint will configure a default cache cluster. To verify this, open a Windows PowerShell as Administrator on any of the web servers and execute the Use-CacheCluster command without parameters to set the context of your PowerShell session to the default cache cluster.

Then execute Get-CacheHost without parameters to list the host machines in the cache cluster.

 

Steps to configure AppFabric cache for Enterprise Portal. I did this on the CA server.

  1. Open a Windows PowerShell command prompt as an administrator.
  2. Execute the Use-CacheCluster command without parameters to set the context of your PowerShell session to the default cache cluster.
  3. Execute the New-Cache command to create a new named cache. Make a note of the name you specified. You will enter this cache name in the next procedure. Set the -Secondaries parameter to 1 to enable the high availability feature.
  4. SharePoint grants cache client access to the accounts in the groups WSS_ADMIN_WPG and WSS_WPG, so you don’t need to execute the Grant-CacheAllowedClientAccount command and specify the .NET Business Connector proxy (the account that is used by the Enterprise Portal application pool).
  5. Export the configuration with this command: Export-CacheClusterConfig and specify a name for the file.
  6. Open the file that you just created and add the following configuration to the <advancedProperties> section and save the file:
    <transportProperties maxBufferSize=”1000000000″ />

  7. Execute the Stop-CacheCluster command to stop the cache.
  8. Import the configuration with this command: Import-CacheClusterConfig and specify the configuration file you just changed.
  9. Execute the Start-CacheCluster command to start the cache.

 

Next: Install EP in the web farm using host header, see https://blogs.msdn.microsoft.com/axsupport/2015/11/09/how-to-install-ax-2012-enterprise-portal-in-a-multi-server-web-farm/

 

After EP has been installed in the web farm, then continue with configuration of the AppFabric cache on the WFE’s.

If the CA server should not be acting as WFE, then stop the web application service on the CA server (SharePoint Central Administration > System Settings > Manage services on this server).

 

On each of the WFE’s (cache clients) do the following:

  1. In Windows explorer, open the C:\inetpub\wwwroot\wss\VirtualDirectories\<EPsite> folder. Ex: C:\inetpub\wwwroot\wss\VirtualDirectories\EP.contoso.com80
    Locate the web.config file and create a backup of this file in a different location.
  2. Open the web.config file in e.g. Notepad.
  3. Locate the <configSections>. Add the following section tag before the <sectionGroup name=”Microsoft.Dynamics”> tag:

    <section name=”dataCacheClient” type=”Microsoft.ApplicationServer.Caching.DataCacheClientSection, Microsoft.ApplicationServer.Caching.Core, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35″ allowLocation=”true” allowDefinition=”Everywhere” />

    If these tags does not already exist in the web.config file, then you need to add it:

    <sectionGroup name=”Microsoft.Dynamics”>
    <section name=”Session” type=”Microsoft.Dynamics.Framework.BusinessConnector.Configuration.SessionConfigurationSection, Microsoft.Dynamics.Framework.BusinessConnector, Version=6.3.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35″ />
    <section name=”ServerState” type=”Microsoft.Dynamics.Framework.Portal.Configuration.ServerStateConfigurationSection, Microsoft.Dynamics.Framework.Portal, Version=6.3.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35″ />
    <section name=”AppFabricCaching” type=”Microsoft.Dynamics.Framework.Portal.Configuration.AppFabricConfigurationSection, Microsoft.Dynamics.Framework.Portal, Version=6.3.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35″ />
    </sectionGroup>

    Note: if you are running AX 2012 R2, then the version numbers in the above sections must be 6.2.0.0

  4. Add the following dataCacheClient tag to the web.config file after the </configSections>. Replace each instance of “Host_server_name” with the name of a cache server. Replace “default” with the name specified when you executed the New-Cache command.

    <dataCacheClient>
    <localCache isEnabled=”false” />
    <hosts>
    <!–List of hosts –>
    <host name=” Host_server_name1″ cachePort=”22233″ />
    <host name=” Host_server_name2″ cachePort=”22233″ />
    <host name=” Host_server_name3″ cachePort=”22233″ />
    </hosts>
    </dataCacheClient>
    <Microsoft.Dynamics>
    <ServerState Enabled=”true” />
    <AppFabricCaching CacheName=”default” />
    </Microsoft.Dynamics>

    Note:
    If the AppFabric Caching Service account (Control Panel > System and Security > Administrative Tools > Services) is running under a domain account then you need to add dataCacheServiceAccountType=”DomainAccount” to the dataCacheClient tag, ref: http://blogs.msdn.com/b/distributedservices/archive/2012/10/29/authenticationexception-in-appfabric-1-1-caching-for-windows-server.aspx

    Example (AppFabric Caching Service running under domain account “contoso\administrator”):

 

To validate the cache deployment, see section “Use the following procedure to validate that the AppFabric cache stores Enterprise Portal session on the server” above in the recommended setup.

 

 

–Article Edited By: Egil I. Skjold

 

–Date: 15/March/2016

We're always looking for feedback and would like to hear from you. Please head to the Dynamics 365 Community to start a discussion, ask questions, and tell us what you think!