public static bool VerifyClusterConfigurations(Alachisoft.NCache.Config.NewDom.CacheServerConfig serverConfig , string cacheName) { if (serverConfig == null) { throw new Exception("Specified cache is not registered on the given server"); } double configVersion = -1; double deploymentVersion = -1; string configId = "dummyconfig"; NCacheRPCService NCache = new NCacheRPCService(""); if (serverConfig.CacheSettings.CacheType == "clustered-cache") { foreach (Address node in serverConfig.CacheDeployment.Servers.GetAllConfiguredNodes()) { NCache.ServerName = node.IpAddress.ToString(); ICacheServer cacheServer = NCache.GetCacheServer(new TimeSpan(0, 0, 0, 30)); ConfigurationVersion config = cacheServer.GetConfigurationVersion(cacheName); if (configId.Equals(configId)) { configId = config.ConfigID; } else if (!configId.Equals(config.ConfigID, StringComparison.InvariantCultureIgnoreCase)) { throw new VersionException("same name cache is already registered on node : " + node.IpAddress, 0); } if (configVersion == -1) { configVersion = config.ConfigVersion; } else if (configVersion != config.ConfigVersion) { throw new VersionException("There is a configuration mismatch for caches : " + cacheName, 0); } if (deploymentVersion == -1) { deploymentVersion = config.DeploymentVersion; } else if (deploymentVersion != config.DeploymentVersion) { throw new Exception("Deployment version is not same on all nodes"); } cacheServer.Dispose(); } } return(true); }