Ejemplo 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));
        }
Ejemplo n.º 2
0
 public KestrelServer(NAMEKestrelConfiguration nameConfiguration, IFilePathMapper pathMapper)
 {
     this.pathMapper        = pathMapper;
     this.nameConfiguration = nameConfiguration;
 }
Ejemplo n.º 3
0
 // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
 public void Configure(IApplicationBuilder app, IFilePathMapper pathMapper, NAMEKestrelConfiguration configuration, NAMESettings settings)
 {
     app.UseMiddleware <NAMEMiddleware>(configuration, settings, pathMapper);
 }