Exemplo n.º 1
0
        public void Configure(IApplicationBuilder app, IHostingEnvironment env, IApplicationLifetime applicationLifetime)
        {
            // Register Shutdown Event
            applicationLifetime.ApplicationStopping.Register(OnShutdown);

            if (env.IsDevelopment())
            {
                app.UseDeveloperExceptionPage();
            }

            // Configure & Start web app process handler
            exeHandler = new ExecutableHandler(
                config.GetValue <string>("appSettings:appProcessName"),
                config.GetValue <string>("appSettings:appProcessArgs"),
                config.GetValue <int>("appSettings:appProcessPort"),
                ParseEnvConfig(config.GetValue <string>("appSettings:appProcessEnv")));

            exeHandler.Start();

            // Configure reverse proxy
            app.UseReverseProxy(new ReverseProxyOptions {
                BaseUrl           = $"http://localhost:" + config.GetValue <int>("appSettings:appProcessPort"),
                ExecutableHandler = exeHandler
            });
        }
Exemplo n.º 2
0
 public ReverseProxyMiddleware(RequestDelegate nextMiddleware, ReverseProxyOptions options)
 {
     this.nextMiddleware = nextMiddleware;
     this.options        = options;
     this.exeHandler     = options.ExecutableHandler;
 }