コード例 #1
0
ファイル: Startup.cs プロジェクト: caizy1709/58HouseSearch
        // 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"];
        }
コード例 #2
0
ファイル: Startup.cs プロジェクト: haoljp/58HouseSearch
        // 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"));
        }