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
- If we want to have few instances of service tier connected to the same or different db. Then we can:
- 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 .
- 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.
- If we want to have fully separate services (including binaries):
- 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
- 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:
- 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.
- Any NAV 2013 service need to be modified by adding dependency (DependsOn) – Net.Tcp Port Sharing Service. This can be done in few ways:
- During service install add parameter “-DependsOn 'NetTcpPortSharing'”
- Use sc.exe utility to modify existing services like: sc.exe config ‘MicrosoftDynamicsNAVServer$NAV70’ depend= NetTcpPortSharing
- 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.