码迷,mamicode.com
首页 > Web开发 > 详细

.net core - 配置管理 - json文件配置

时间:2019-03-13 12:24:53      阅读:208      评论:0      收藏:0      [点我收藏+]

标签:exception   format   ISE   col   collect   except   root   The   star   

Json 文件配置

 1     public class Startup
 2     {
 3         public Startup(IHostingEnvironment env)
 4         {
 5             var builder = new ConfigurationBuilder()
 6                 .AddJsonFile("Class.json");
 7 
 8             Configuration = builder.Build();
 9         }
10 
11         public IConfigurationRoot Configuration { get; }
12 
13         // This method gets called by the runtime. Use this method to add services to the container.
14         // For more information on how to configure your application, visit https://go.microsoft.com/fwlink/?LinkID=398940
15         public void ConfigureServices(IServiceCollection services)
16         {
17             services.AddMvc();
18         }
19 
20         // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
21         public void Configure(IApplicationBuilder app, IHostingEnvironment env)
22         {
23             if (env.IsDevelopment())
24             {
25                 app.UseDeveloperExceptionPage();
26             }
27 
28             app.Run(async (context) =>
29             {
30                 await context.Response.WriteAsync("Hello World!");
31             });
32         }
33     }

 

.net core - 配置管理 - json文件配置

标签:exception   format   ISE   col   collect   except   root   The   star   

原文地址:https://www.cnblogs.com/chenxinyuan/p/10522104.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!