private ServiceHost StartGame(CGame game) { Int32 usedPort = _nextPort++; String serviceUrl = $"net.tcp://localhost:{usedPort}"; var urls = new[] { new Uri(serviceUrl) }; IMapLoader mapLoader = CXmlMapLoader.Create("C:\\Users\\Pavel\\Pavel.Ilushenko\\OwnProject\\BusinessLayer\\TestMap.xml"); CMap map = CMap.Create(mapLoader); IGameService service = new GameService(map, game.GetPlayers().Select(p => p.PlayerInfo)); var host = new ServiceHost(service, urls); var binding = new NetTcpBinding(SecurityMode.None); host.AddServiceEndpoint(typeof(IGameService), binding, String.Empty); host.Opened += HostOnOpened; host.Open(); _gameServiceHosts.Add(host); return(host); }