====== Replication Service - Using NAS Service ====== Setting up E-Commerce Replication Service using a dedicated NAV Server instance and [[https://msdn.microsoft.com/en-us/library/dd355183(v=nav.90).aspx|setting up a NAS Service]] is the recommended method for production environments. Having Replication Service running on NAS Service provides improved reliability and manageability of the Replication Service, which is desirable for IT administration. This page provides the details of setting up a NAS Service for E-Commerce, which is only available to IT administrators having full access to the Dynamics NAV Server. Setting up the E-Commerce Replication Service using NAS Services involves the following procedure. \\ **Step 1 - Create a new NAV Server Instance** Start **Microsoft Dynamics NAV 2016 Administration** tool, which will show the list of Dynamics NAV Server instances currently configured. Click **Add Instance**, and complete the dialog e.g. as follows: {{:admin:e-commerce_setup:setup_replication:nas-new-instance.png?nolink|}} Ensure to provide the port numbers that are currently not used by other services on the server, and provide the proper account credentials for the Replication Service. //Alternatively, you can create a NAV Server instance by issuing the following command withing the **Dynamics NAV 2016 Administration Shell**// Get-Credential | New-NAVServerInstance ECMReplService -ManagementServicesPort 7745 -ServiceAccount User Refer to [[https://msdn.microsoft.com/en-us/library/hh168936%28v=nav.90%29.aspx|the relevant Microsoft documentation]] for details. \\ **Step 2 - Configure the Instance for Replication Service** Now that your **ECMReplService** service appears on the list of the instances, select the instance and click **Edit** to configure the service settings. Complete the **General** and **Database** sections according to your setup and ensure the service uses the proper Dynamics NAV database. Refer to [[https://msdn.microsoft.com/en-us/library/dd355055(v=nav.90).aspx|the relevant Microsoft documentation]] for details. Disable Client Services, SOAP Services, and OData Services, by removing **Enable Client Services**, **Enable SOAP Services**, and **Enable OData Services** respectively. This will save system resources and will protect you against unanticipated use of the service. In **General** section, complete the **Services Default Company** field with the exact name of the Dynamics NAV company that you are connecting to the Storefront. In **NAS Services** section, type **25026288** in the **Startup Codeunit** field. {{:admin:e-commerce_setup:setup_replication:nas-settings.png?nolink|}} Click **Save** to save the service settings. //Alternatively, you can confiure the instance by issuing the following commands withing the **Dynamics NAV 2016 Administration Shell**// Set-NAVServerConfiguration ECMReplService -KeyName DatabaseServer -KeyValue "" Set-NAVServerConfiguration ECMReplService -KeyName DatabaseName -KeyValue "" Set-NAVServerConfiguration ECMReplService -KeyName ServicesDefaultCompany -KeyValue "" Set-NAVServerConfiguration ECMReplService -KeyName NASServicesStartupCodeunit -KeyValue 25026288 \\ **Step 3 - Grant the appropriate NAV permissions to the Service Account** In order for the Replication Service to run, it must be able to read and write the appropriate tables in your Dynamics NAV. Since the NAS Service will be accessing Dynamics NAV database with the user account set up as the Service Account when configuring the service, you must create the Service Account as a User in Dynamics NAV, and assign the appropriate Permission Set to the User. If you have imported the [[admin:e-commerce_setup:base_configuration|base configuration package]] for E-Commerce B2B, your Dynamics NAV will contain the **ECM-REPLICATION** Permission Set, which contains the permissions necessary for Replication Service. The easiest way to accomplish the task is issuing the following commands withing the **Dynamics NAV 2016 Administration Shell**. New-NAVServerUser DynamicsNAV90 -WindowsAccount ECMService New-NAVServerUserPermissionSet DynamicsNAV90 -WindowsAccount ECMService -PermissionSetId ECM-REPLICATION //Note: Since the Replication Service instance cannot be started yet (due to permissions), and the listed commands can only be executed with an running NAV Server instance, the example uses DynamicsNAV90 instance for granting permissions. You should use any running instance that is connected to the same SQL database that ECMReplService is using.// Alternatively, you can open **Dynamics NAV Client**, navigate to **Users** list, click **New** and complete the User fields, including the **ECM-REPLICATION** in the list of user's Permission Sets. You have now set up a dedicated NAS instance for E-Commerce B2B Replication Service. Starting the service will start the Replication Service process, which ensures the automated data flow between Dynamics NAV and the Storefront. Any technical errors that prevented the NAS instance to start can be inspected using the Event Viewer on the server, and you can use the [[admin:e-commerce_maintenance|monitoring tools]] provided with E-Commerce B2B to ensure the Replication Service is up and running.