Dynamics NAV 2013 R2
How to share same port between multiple instances
If you want to share same port between multiple instances on the same server you have to do these steps:
- Create multiple instances in NAV using same port (
- Stop all NAV instances
- Enable Net.TCP Port Sharing service (by default is startup Disabled): Set startup to automatic
- On each NAV instance's service add dependency on Net TCP port sharing service:
sc config MicrosoftDynamicsNavServer$NavInstanceName depend= NetTcpPortSharing/HTTP
- If you are running NAV as your domain based service account (which you should) find out its SID:
wmic useraccount where (name='service-account-login' and domain='%userdomain%') get name,sid
- Find out which config file is used for port sharing service:
- Open Service details of Net.TCP Port Sharing Service
- Check Path to executable
- Append .config to the path
- Edit this config file by adding:
<system.serviceModel.activation> <net.tcp listenBacklog="10" maxPendingConnections="100" maxPendingAccepts="2" receiveTimeout="00:00:10" teredoEnabled="false"> <allowAccounts> <add securityIdentifier="--SID of your service account--"/> </allowAccounts> </net.tcp> </system.serviceModel.activation>
- Restart all services depending on
SMSvcHost.exeexecutable to reload with new .config configuration (or to be sure whole server).
- Start all NAV instances, now they should be using same configured port without any error.
Errors that you can see
Only one usage of each socket address
The service MicrosoftDynamicsNavServer$ApsTest failed to start. This could be caused by a configuration error. Detailed error information:System.ServiceModel.AddressAlreadyInUseException: There is already a listener on IP endpoint 0.0.0.0:7046. This could happen if there is another application already listening on this endpoint or if you have multiple service endpoints in your service host with the same IP endpoint but with incompatible binding configurations. ---> System.Net.Sockets.SocketException: Only one usage of each socket address (protocol/network address/port) is normally permitted
This error occurs when you forgot to add dependency on
NetTcpPortSharing service on your NAV instances services.
The service MicrosoftDynamicsNavServer$ApsTest failed to start. This could be caused by a configuration error. Detailed error information:System.ServiceModel.CommunicationException: The service endpoint failed to listen on the URI 'net.tcp://server:7046/ApsTest/Service' because access was denied. Verify that the current user is granted access in the appropriate allowAccounts section of SMSvcHost.exe.config. ---> System.ComponentModel.Win32Exception: Access is denied
This error occurs when you forgot to add SID of your system account to the
SMSvcHost.exe.config file or if you update wrong config file (there are multiple files with this name on the server).