// This method gets called by the runtime. Use this method to configure the HTTP request pipeline. public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory) { // loggerFactory.AddNLog();//添加NLog env.ConfigureNLog("nlog.config"); loggerFactory.AddConsole(); if (env.IsDevelopment()) { app.UseDeveloperExceptionPage(); } app.UseStaticFiles(); app.UseMvcWithDefaultRoute(); app.UseMvc(routes => { routes.MapRoute( name: "default", template: "{controller=House}/{action=Index}/{id?}"); }); PVHelper.InitWebPVInfo(Path.Combine(env.WebRootPath, "pv.json")); ConnectionStrings.MySQLConnectionString = new ConfigurationBuilder() .SetBasePath(Directory.GetCurrentDirectory()) .AddJsonFile("appsettings.json").Build()["ConnectionStrings:MySQLConnectionString"]; }
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline. public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory) { // loggerFactory.AddNLog();//添加NLog env.ConfigureNLog("nlog.config"); loggerFactory.AddConsole(); if (env.IsDevelopment()) { app.UseDeveloperExceptionPage(); } app.UseStaticFiles(); app.UseMvcWithDefaultRoute(); app.UseMvc(routes => { routes.MapRoute( name: "default", template: "{controller=House}/{action=Index}/{id?}"); //(手动高亮) }); PVHelper.InitWebPVInfo(Path.Combine(env.WebRootPath, "pv.json")); }