Example #1
0
        /// <summary>
        ///     Applies the configuration of the server to the instance.
        /// </summary>
        /// <param name="configuration">
        ///     The <see cref="AspServerConfiguration" /> used to initialize the instance.
        /// </param>
        /// <param name="initializer">The initializer used to setup the pipeline for this instance.</param>
        public void ApplyConfiguration(IAspServerConfiguration configuration, IAspInitializer initializer)
        {
            if (configuration == null)
            {
                throw new ArgumentNullException("configuration");
            }

            if (initializer == null)
            {
                throw new ArgumentNullException("initializer");
            }

            _config       = configuration;
            _httpListener = new HttpListener();

            _httpListener.Prefixes.Add(
                string.Format(CultureInfo.InvariantCulture, "http://*:{0}{1}", _config.Port, _config.VirtualPath));
            _processor = initializer.ConfigurationInitializer(_config.VirtualPath, _config.PhysicalPath);
        }
Example #2
0
        /// <summary>
        ///     Applies the configuration of the server to the instance.
        /// </summary>
        /// <param name="configuration">
        ///     The <see cref="AspServerConfiguration" /> used to initialize the instance.
        /// </param>
        /// <param name="initializer">The initializer used to setup the pipeline for this instance.</param>
        public void ApplyConfiguration(IAspServerConfiguration configuration, IAspInitializer initializer)
        {
            if (configuration == null)
            {
                throw new ArgumentNullException("configuration");
            }

            if (initializer == null)
            {
                throw new ArgumentNullException("initializer");
            }

            _config = configuration;
            _httpListener = new HttpListener();

            _httpListener.Prefixes.Add(
                string.Format(CultureInfo.InvariantCulture, "http://*:{0}{1}", _config.Port, _config.VirtualPath));
            _processor = initializer.ConfigurationInitializer(_config.VirtualPath, _config.PhysicalPath);
        }