Configure firewall for Ports (Optional)
If you have a firewall or a router between your cache clients (web/app servers) and the cache servers, then you must open up specific ports in your firewall. This will ensure that the cache clients can talk to the cache servers.
NCache server uses the following TCP ports for communication.
- Client/Server Port: 9800 (The default TCP port for the cache client and server communication.)
- Management Port: 8250 (The default TCP port for the PowerShell cmdlets and the NCache Service.)
- Cluster Port: The Cluster port that you define in cache cluster configuration. It is recommended to use a consecutive range of ports. (The default range is 7800-7900). Configure firewall to allow communication on this port range.
- Cache Management Port: The port range for cache management. (The default port range is 8300-8400.)
But, if there is a port conflict and the above default ports are being used by other applications, then you must configure all the cache servers to use different ports.
Step 1: Modify Cache Service Configuration File
The cache service configuration file is found in the NCache installation at %NCHOME%\bin\service\Alachsioft.NCache.Service.exe.config.
Change the Port for the Client/Server communication and ManagementPort for the NCache management in the file below.
<appSettings>
...
<add key="NCacheServer.Port" value="9800"/>
...
<add key="NCacheServer.ManagementPort" value="8250"/>
...
</appSettings>
Step 2: Restart NCache Service
For the configuration changes made to take effect, restart the NCache Service.
Make sure you have enough privileges to restart the service. If the user is not the part of Administrator's group, make sure to run PowerShell as Administrator, otherwise, you might get an error message stating "Cannot open ncachesvc service on computer".
Execute the following command in PowerShell to restart the NCache Service:
Restart-Service -Name NCacheSvc
See Also
Create a Cache
Simulate Cache Usage
Monitor Caches in PerfMon
Use NCache from .NET Application
Use NCache for ASP.NET Sessions