Esempio n. 1
0
        /// <summary>
        /// Enables the NAME self host server.
        /// </summary>
        /// <param name="nameConfigBuilder">The name configuration builder.</param>
        /// <returns>Returns an <see cref="IDisposable"/> proxy object containing the Parsed Dependencies and a way to stop the server.</returns>
        /// <exception cref="NAMEException">Error parsing the dependencies file.</exception>
        /// <exception cref="DependenciesCheckException">Happens when <see cref="NAMEBaseConfiguration.ThrowOnDependenciesFail"/> is set to true and dependencies check fail.</exception>
        public static SelfHostResult EnableName(Action <NAMEKestrelConfiguration> nameConfigBuilder)
        {
            var config = new NAMEKestrelConfiguration();

            nameConfigBuilder?.Invoke(config);

            var pathMapper = new StaticFilePathMapper();

            var server             = new KestrelServer(config, pathMapper);
            var parsedDependencies = SelfHostInitializer.Initialize(server, pathMapper, config);

            return(new SelfHostResult(parsedDependencies, server));
        }
Esempio n. 2
0
        /// <summary>
        /// Enables the NAME self host server.
        /// </summary>
        /// <param name="nameConfigBuilder">The name configuration builder.</param>
        /// <returns>
        /// Returns an <see cref="IDisposable" /> proxy object containing the Parsed Dependencies and a way to stop the server.
        /// </returns>
        /// <exception cref="NAMEException">Error parsing the dependencies file.</exception>
        /// <exception cref="DependenciesCheckException">Happens when <see cref="NAMEBaseConfiguration.ThrowOnDependenciesFail" /> is set to true and dependencies check fail.</exception>
        public static SelfHostResult EnableName(Action <NAMEHttpListenerConfiguration> nameConfigBuilder)
        {
            var nameConfiguration = new NAMEHttpListenerConfiguration();

            nameConfigBuilder?.Invoke(nameConfiguration);

            var pathMapper = new StaticFilePathMapper();

            var server             = new HttpListenerServer(nameConfiguration, pathMapper);
            var parsedDependencies = SelfHostInitializer.Initialize(server, pathMapper, nameConfiguration);

            return(new SelfHostResult(parsedDependencies, server));
        }