示例#1
0
        // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
        public void Configure(IApplicationBuilder app, IHostingEnvironment env, IMensagemService msg)
        {
            if (env.IsDevelopment())
            {
                app.UseDeveloperExceptionPage();
            }
            else
            {
                app.UseExceptionHandler();
            }



            //app.UseStaticFiles();

            app.UseStaticFiles(new StaticFileOptions()
            {
                FileProvider = new PhysicalFileProvider
                                   (Path.Combine(Directory.GetCurrentDirectory(), @"Arquivos")),
                RequestPath = new PathString("/Arquivos")
            });

            app.Run(async(context) =>
            {
                //var mensagem = _config["Mensagem"];
                //var conexao = _config["ConnectionStrings:DefaultConnection"];
                //await context.Response.WriteAsync(mensagem);
                await context.Response.WriteAsync(msg.GetMensagem());
            });
        }
示例#2
0
        // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
        public void Configure(IApplicationBuilder app, IHostingEnvironment env, IMensagemService msg)  //IMensagemService msg injetando dependência
        {
            if (env.IsDevelopment())
            {
                app.UseDeveloperExceptionPage();
            }

            //app.UseStaticFiles();

            app.Run(async(context) =>
            {
                //var mensagem = _config["Mensagem"];
                //var conexao = _config["ConnectionStrings:DefaultConnection"];

                //await context.Response.WriteAsync(mensagem);
                //await context.Response.WriteAsync(conexao);

                await context.Response.WriteAsync(msg.GetMensagem());
            });
        }