示例#1
0
 /// <summary>
 /// Create an instance of <see cref="WebAppServer"/>.
 /// </summary>
 /// <param name="urlReservation">
 /// The URL reservation to listen on. This string is similar to a URL, but the
 /// hostname may be a strong wildcard ('+') or a weak wildcard ('*'). E.g. "http://+:8080/".
 /// </param>
 public WebAppServer(string urlReservation)
 {
     _urlRegex = new Regex("^" + urlReservation.Replace("*", ".*?").Replace("+", ".*?"), RegexOptions.IgnoreCase);
     _listener = new HttpListener();
     _listener.Prefixes.Add(urlReservation);
     _disconnectHandler = new DisconnectHandler(_listener);
     var uri = new Uri(urlReservation.Replace("*", "localhost").Replace("+", "localhost"));
     _webAppConfiguration = new WebAppConfiguration(uri);
     StaticFiles = new StaticFileSpecCollection();
 }
示例#2
0
        /// <summary>
        /// Create an instance of <see cref="WebAppServer"/>.
        /// </summary>
        /// <param name="urlReservation">
        /// The URL reservation to listen on. This string is similar to a URL, but the
        /// hostname may be a strong wildcard ('+') or a weak wildcard ('*'). E.g. "http://+:8080/".
        /// </param>
        public WebAppServer(string urlReservation)
        {
            _urlRegex = new Regex("^" + urlReservation.Replace("*", ".*?").Replace("+", ".*?"), RegexOptions.IgnoreCase);
            _listener = new HttpListener();
            _listener.Prefixes.Add(urlReservation);
            _disconnectHandler = new DisconnectHandler(_listener);
            var uri = new Uri(urlReservation.Replace("*", "localhost").Replace("+", "localhost"));

            _webAppConfiguration = new WebAppConfiguration(uri);
            StaticFiles          = new StaticFileSpecCollection();
        }
示例#3
0
 public WebApiServer(WebAppConfiguration config)
     : base(config)
 {
     _config = config;
 }