How to have few Microsoft Dynamics NAV 2013 services on the same server

How to have few Microsoft Dynamics NAV 2013 services on the same server

Rate This
  • Comments 5

Sometimes we need to have few Microsoft Dynamics NAV 2013 services connected to different SQL databases but running on the same server. Let us say few developers are working on different databases and want to see how RTC works with their customizations. Or maybe we want to compare how different RTC versions/builds work and want to compare functionality.
In article
http://blogs.msdn.com/b/nav/archive/2009/11/17/how-to-run-2-rtc-on-the-same-pc-and-connect-it-to-different-db-how-to-run-pages-reports-from-diff-db.aspx I described how to have few RTC on the same client computer in NAV 2009. This is also very useful now in NAV 2013, but let us look what new we have in NST site in NAV 2013

With Microsoft Dynamics NAV 2013 we have few solutions how to create new NAV service (NST). First NAV 2013 Service we already have installed by NAV DVD and now we want to have more

  1.  If we want to have few instances of service tier connected to the same or different db. Then we can:
    1. Use Microsoft Dynamics NAV Administration Tools (Administration console) as described at http://msdn.microsoft.com/en-us/library/hh165851(v=nav.70).aspx . With it we can create new instance of the same service as it is described at http://msdn.microsoft.com/en-us/library/hh168936(v=nav.70).aspx .
    2. Use Microsoft Dynamics NAV Windows PowerShell Cmdlets. This can be done by running Microsoft Dynamics NAV Shell and execute cmdlet “New-NAVServerInstance” as it is described at http://msdn.microsoft.com/en-us/library/hh173394(v=nav.70).aspx . Required parameters can be find by execute “Get-Help New-NAVServerInstance –full” in shell. But for example if I want to create new instance named “TestNAV70” then I execute:
      New-NAVServerInstance -ServerInstance TestNAV70 -ClientServicesPort 7600 -ManagementServicesPort 7601 -ODataServicesPort 7602 -SOAPServicesPort 7603
      Four ports parameters are required to add here.
      There will be new folder TestNAV70 created in c:\Program Files\Microsoft Dynamics NAV\70\Service\Instances and it includes two configuration files.
      This instance will be visible in Microsoft Dynamics NAV Administration Tools, where you can change database name, start, stop service etc.
      Users now can connect to these instances and work with RTC.
      Advantages: easy/simple creation, usage and administration. For example, have customer db and want to see how report works on it in comparing to Cronus: create new instance, point it to customer db, run RTC using these ports and connect to required service.
      Disadvantages: Used another ports – RTC configs need to be modified. Firewall need to be configured. Used the same binaries.
  2. If we want to have fully separate services (including binaries):
    1. We can use the same way as it was in NAV 2009 – use sc.exe utility and execute it with parameters as it is described at http://blogs.msdn.com/b/nav/archive/2009/10/20/creating-a-web-service-manually-the-importance-of-what-name-you-give-it-and-a-few-small-things-to-remember.aspx or at http://blogs.msdn.com/b/freddyk/archive/2008/10/29/multiple-service-tiers.aspx
    2. Or use Windows power shell “New-Service” tasklet like:
      New-Service -Name 'MicrosoftDynamicsNAVServer$TestNAV70' -BinaryPathName '"D:\NAV 7\Service\Microsoft.Dynamics.Nav.Server.exe" $TestNAV70 /config "D:\NAV 7\Service\Microsoft.Dynamics.NAV.Server.exe.config"' -DependsOn 'NetTcpPortSharing' -Description 'Service handling TestNAV70' -DisplayName 'Microsoft Dynamics NAV 70 Server [TestNAV70]' -StartupType Manual
      Here my new service is ‘TestNAV70’ and binaries are in folder ‘D:\NAV 7\Service’. Service depends on 'NetTcpPortSharing'.
      Now I can modify servise CustomSettings.Config file to force to connect to required db, use required ports, name service instance (for example ‘NAV70Test’). ATTENTION: when RTC connects to service instance, it must to use in service CustomSettings.Config file described ports and service instance name (Not windows service name used in service creation TestNAV70, but service instance name – NAV70Test).

      Advantages: Can use different binaries (builds or versions); can share the same ports between few services – users can use the same client config file, just change service instance name.
      Disadvantages: Not easy to create and configure.

In both ways created services can be managed using Microsoft Dynamics NAV Administration Tools, so it is very easy modify services for any further needs. However if we try to remove service by using function “Remove”, then tools uninstall service and remove folder (including all binaries) and this can be problem if we have few services based on the same binaries folder.

Few Microsoft Dynamics NAV 2013 services can share the same TCP communication ports (Attention: do not mix it with NAV 2009). However, here are few tricks need to do before we use port sharing:

  1. Windows service NetTcpPortSharing must to run on computer where NAV services are running. By default this service is not started, so you need to set service “startup type” to “Automatic” and start it.
  2. Any NAV 2013 service need to be modified by adding dependency (DependsOn) – Net.Tcp Port Sharing Service. This can be done in few ways:
    1.  During service install add parameter “-DependsOn 'NetTcpPortSharing'”
    2. Use sc.exe utility to modify existing services like: sc.exe config ‘MicrosoftDynamicsNAVServer$NAV70’ depend= NetTcpPortSharing
    3. Modify windows registry key using regedit utility. Go to HKLM\System\CurrentControlSet\Services\MicrosoftDynamcisNAVServer$NAV70; and add/modify key DependOnService = NetTcpPortSharing

 

These postings are provided "AS IS" with no warranties and confer no rights. You assume all risk for your use.

Gedas Busniauskas
Microsoft Lithuania
Microsoft Customer Service and Support (CSS) EMEA

Leave a Comment
  • Please add 4 and 4 and type the answer here:
  • Post
  • Thanks for this useful post.  Is it possible to control which version is used to create a new instance when using the Administration Tool?  For exmaple I've got a few services running 7.0.33995 and I now want to create a new one running  7.0.34194.  That fine, I can create a new service using sc create.  

    If I want to then add another 7.0.34194 instance, can I create one using the admin tool?  Failing that can I manually add config files to the instances folder for my 7.0.34194 service or do I have to create more services using sc create?

  • Hi, does the different services really use different build versions?

    I understand that the executable binaries are used from the directory they are started from but what about the dlls? Aren't they registered to the registry during install. So when C:\AnotherBuild\Microsoft.Dynamics.Nav.Server.exe is runnning and needs some functionality from a Nav dll it calls from registry that where the particular dll is installed. Doesn't the registry then point out the dll from the first install directory (probably C:\Program Files\Microsoft Dynamics NAV\70\Service)? And because there are multiple builds running on the same server isn't this firstly installed dll from a different build than the executable itself?

    This is the main reason I'm hesitant to run different build version on the same server. Am I just nitpicking or have I misunderstood the way dlls work in Windows?

  • very useful post

  • All dlls related to new build has to be in new folder (for example C:\Program Files\Microsoft Dynamics NAV\70\Service Latest) and of course RTC client needs own folder with the new build too. Then it works.

    In this case I have only one issue - debugger, by running it there is en error message:

    The client version does not match the server version. You can only connect to a server with a matching version.

    Client version: 7.0.33781.0

    Server version: 7.0.34902.0

    Of course running from 7.0.34902 client. Any idea what to change?

  • Hi

    Whenever I do step 2 part b (using powershell to create the service), My service is created but when I look in the Administration Tool, the service is called (Default).  I have changed the service instance in the config file.  Any ideas?

    TIA

    Chris

Page 1 of 1 (5 items)