分享web开发知识

注册/登录|最近发布|今日推荐

主页 IT知识网页技术软件开发前端开发代码编程运营维护技术分享教程案例
当前位置:首页 > 代码编程

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

发布时间:2023-09-06 02:35责任编辑:沈小雨关键词:jsjson配置

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=39894015 ????????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文件配置

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

知识推荐

我的编程学习网——分享web前端后端开发技术知识。 垃圾信息处理邮箱 tousu563@163.com 网站地图
icp备案号 闽ICP备2023006418号-8 不良信息举报平台 互联网安全管理备案 Copyright 2023 www.wodecom.cn All Rights Reserved