public void Add(UrlPrefix item) { lock (_prefixes) { var id = _nextId++; if (_urlGroup != null) { _urlGroup.RegisterPrefix(item.FullPrefix, id); } _prefixes.Add(id, item); } }
internal void RegisterAllPrefixes(UrlGroup urlGroup) { lock (_prefixes) { _urlGroup = urlGroup; // go through the uri list and register for each one of them // Call ToList to avoid modification when enumerating. foreach (var pair in _prefixes.ToList()) { var urlPrefix = pair.Value; if (urlPrefix.PortValue == 0) { if (urlPrefix.IsHttps) { throw new InvalidOperationException("Cannot bind to port 0 with https."); } FindHttpPortUnsynchronized(pair.Key, urlPrefix); } else { // We'll get this index back on each request and use it to look up the prefix to calculate PathBase. _urlGroup.RegisterPrefix(pair.Value.FullPrefix, pair.Key); } } } }
internal void RegisterAllPrefixes(UrlGroup urlGroup) { lock (_prefixes) { _urlGroup = urlGroup; // go through the uri list and register for each one of them foreach (var pair in _prefixes) { // We'll get this index back on each request and use it to look up the prefix to calculate PathBase. _urlGroup.RegisterPrefix(pair.Value.FullPrefix, pair.Key); } } }