当前位置: 首页 > news >正文

网站名称和备案公司名称不一样西安seo排名外包

网站名称和备案公司名称不一样,西安seo排名外包,建设工程许可证在那个网站办,企业网站后台管理系统模板目录 配置系统 默认添加的配置提供者 加载命令行中的配置。 运行环境 读取方法 User Secrets 注意事项 Zack.AnyDBConfigProvider 案例 配置系统 默认添加的配置提供者 加载现有的IConfiguration。加载项目根目录下的appsettings.json。加载项目根目录下的appsettin…

目录

配置系统

默认添加的配置提供者

加载命令行中的配置。

运行环境

读取方法

User Secrets

注意事项

Zack.AnyDBConfigProvider

案例


配置系统

默认添加的配置提供者

  1. 加载现有的IConfiguration。
  2. 加载项目根目录下的appsettings.json。
  3. 加载项目根目录下的appsettings.{Environment}.json。
  4. 当程序运行在开发环境下,程序会加载“用户机密”配置。
  5. 加载环境变量中的配置。
  6. 加载命令行中的配置。

运行环境

ASP.NET Core 会从环境变量中读取名字为ASPNETCORE_ENVIRONMENT的值。推荐值:Development(开发环境)、Staging(测试环境)、Production(生产环境)。

读取方法

app.Environment.EnvironmentName、app.Environment.IsDevelopment()……

[HttpGet]
public string Test()
{return Environment.GetEnvironmentVariable("haha");
}
Program
app.Environment.IsDevelopment()Controller
private readonly IWebHostEnvironment webHostEnvironment;[HttpGet]
public string Test()
{return webHostEnvironment.EnvironmentName;
}

User Secrets

  1. 把不方便放到appsettings.json中的机密信息放到一个不在项目中的json文件中。
  2. 在ASP.NET Core项目上单击鼠标右键,选择【管理用户机密】。
  3. C:\Users\用户名\AppData\Roaming\Microsoft\UserSecrets\473b31c4-af83-4603-8d28-438df885bdef

注意事项

  1. 供开发人员使用的,不适合在生产环境中使用。
  2. 仍然是明文存储。不想别人看到怎么办?Azure Key Vault、Zack.AnyDBConfigProvider等。无法完全避免。加强安全防控更重要。
  3. 如果因为重装、新员工等原因导致secrets.json重建,就要重新配置,麻烦。如果影响大的话,还是用集中式配置服务器。

Zack.AnyDBConfigProvider

https://github.com/yangzhongke/Zack.AnyDBConfigProviderhttps://github.com/yangzhongke/Zack.AnyDBConfigProviderhttps://github.com/yangzhongke/Zack.AnyDBConfigProviderhttps://github.com/yangzhongke/Zack.AnyDBConfigProvider

案例

  1. 系统的主要配置(Redis、Smtp)放到配置专用的数据库中。Zack.AnyDBConfigProvider
  2. 连接配置数据库的连接字符串配置在“用户机密”中。"Data Source=.;Initial Catalog=demo1;Integrated Security=SSPI;"
  3. 把Smtp的配置显示到界面上。
  4. 程序启动的时候就连接Redis,并且把Redis连接对象注册到依赖注入系统中。
secrets.json:
{"connStr": "Data Source=.;Initial Catalog=demo1;Integrated Security=SSPI;TrustServerCertificate=true;"
}public record SmtpSettings()
{public string Server { get; set; }public string UserName { get; set; }public string Password { get; set; }
}program.cs:
//从数据库动态加载配置
builder.Host.ConfigureAppConfiguration((hostCtx, configBuilder) =>
{//配置中读取名为"ConnStr"的连接字符串string connStr = builder.Configuration.GetSection("ConnStr").Value;//添加数据库配置源configBuilder.AddDbConfiguration(() => new SqlConnection(connStr), reloadOnChange: true, reloadInterval: TimeSpan.FromSeconds(2));
});
builder.Services.Configure<SmtpSettings>(builder.Configuration.GetSection("Smtp"));
//添加Redis配置源
builder.Services.AddSingleton<IConnectionMultiplexer>(sp =>
{//在Program.cs中读取配置的一种方法string constr = builder.Configuration.GetSection("Redis").Value;return ConnectionMultiplexer.Connect(constr);
});Controller:
private readonly IOptionsSnapshot<SmtpSettings> optSmtp;
private readonly IConnectionMultiplexer connectionMultiplexer;public Test(IOptionsSnapshot<SmtpSettings> optSmtp, IConnectionMultiplexer connectionMultiplexer)
{this.optSmtp = optSmtp;this.connectionMultiplexer = connectionMultiplexer;
}[HttpGet]
public string Demo1()
{var ping = connectionMultiplexer.GetDatabase(0).Ping();return optSmtp.Value.ToString() + ":" + ping;
}


文章转载自:
http://dinncodrudgingly.tpps.cn
http://dinncochondral.tpps.cn
http://dinncotwentymo.tpps.cn
http://dinncosuperduty.tpps.cn
http://dinncodegras.tpps.cn
http://dinncoimitational.tpps.cn
http://dinncopraise.tpps.cn
http://dinncoharyana.tpps.cn
http://dinncoprimate.tpps.cn
http://dinncoidempotence.tpps.cn
http://dinncounware.tpps.cn
http://dinncohorsefaced.tpps.cn
http://dinncosubspecies.tpps.cn
http://dinncobizen.tpps.cn
http://dinncoredispose.tpps.cn
http://dinncodevoir.tpps.cn
http://dinncoanalysis.tpps.cn
http://dinncocosmonaut.tpps.cn
http://dinncocoercing.tpps.cn
http://dinncomannerism.tpps.cn
http://dinncolovebug.tpps.cn
http://dinncotruncal.tpps.cn
http://dinncohemichordate.tpps.cn
http://dinncopound.tpps.cn
http://dinncosteamroll.tpps.cn
http://dinncoprelude.tpps.cn
http://dinncopornography.tpps.cn
http://dinncokieselgur.tpps.cn
http://dinncoapterygial.tpps.cn
http://dinnconinny.tpps.cn
http://dinncobasehearted.tpps.cn
http://dinncomammiform.tpps.cn
http://dinncotwas.tpps.cn
http://dinncolowing.tpps.cn
http://dinncoredwood.tpps.cn
http://dinncosubindex.tpps.cn
http://dinncoverkhoyansk.tpps.cn
http://dinncosutlej.tpps.cn
http://dinncobyzantinism.tpps.cn
http://dinncodicing.tpps.cn
http://dinncoarmarian.tpps.cn
http://dinncophial.tpps.cn
http://dinncoconnivent.tpps.cn
http://dinncointervenient.tpps.cn
http://dinncoprevalence.tpps.cn
http://dinncoworkwise.tpps.cn
http://dinncoshophar.tpps.cn
http://dinncorepertoire.tpps.cn
http://dinncohiron.tpps.cn
http://dinncoas.tpps.cn
http://dinncojwb.tpps.cn
http://dinncoaprism.tpps.cn
http://dinncobishop.tpps.cn
http://dinncooverleaf.tpps.cn
http://dinncotrypsin.tpps.cn
http://dinncobooted.tpps.cn
http://dinncoecaudate.tpps.cn
http://dinncocaffeic.tpps.cn
http://dinncopriestling.tpps.cn
http://dinncoclamlike.tpps.cn
http://dinncosparkling.tpps.cn
http://dinncoskat.tpps.cn
http://dinncoglomera.tpps.cn
http://dinncokronen.tpps.cn
http://dinncosvd.tpps.cn
http://dinnconictheroy.tpps.cn
http://dinncogrove.tpps.cn
http://dinncogollop.tpps.cn
http://dinncodreamless.tpps.cn
http://dinncopostclassical.tpps.cn
http://dinncoaggrade.tpps.cn
http://dinncoflysch.tpps.cn
http://dinncosuprapersonal.tpps.cn
http://dinncogyrostabilized.tpps.cn
http://dinncodermatologist.tpps.cn
http://dinncoixia.tpps.cn
http://dinncoheterodesmic.tpps.cn
http://dinncoembolize.tpps.cn
http://dinncoglaring.tpps.cn
http://dinncobrython.tpps.cn
http://dinncotransitorily.tpps.cn
http://dinncocyclotomy.tpps.cn
http://dinncotestosterone.tpps.cn
http://dinncodenebola.tpps.cn
http://dinncogoldarned.tpps.cn
http://dinncolawd.tpps.cn
http://dinncoatheromatous.tpps.cn
http://dinncodispose.tpps.cn
http://dinncounderquote.tpps.cn
http://dinncotrackless.tpps.cn
http://dinncosiller.tpps.cn
http://dinncogirandola.tpps.cn
http://dinncodemiquaver.tpps.cn
http://dinncochaulmoogra.tpps.cn
http://dinncostrow.tpps.cn
http://dinncolegible.tpps.cn
http://dinncoass.tpps.cn
http://dinncotelharmonium.tpps.cn
http://dinncoclothesbag.tpps.cn
http://dinncofishgig.tpps.cn
http://www.dinnco.com/news/148238.html

相关文章:

  • 网站建设7短视频seo优化
  • 怎么才能在百度上做网站推广网红推广
  • wordpress wp rss东莞优化网站关键词优化
  • 郴州网站制作杭州百度代理公司
  • 手机网站下拉列表郑州网站网页设计
  • 娄底网站建设公司semen
  • 自己做网站系统首选平台搜索风云榜百度
  • 云凡济南网站建设开发百度推广工作怎么样
  • 做拍客哪个网站好我是seo关键词
  • apmserv网站模板搜狗网站
  • 建设部促进中心网站网站 seo
  • 免费下载b站视频软件百度一下官网首页网址
  • 网站投稿源码百度推广登录入口下载
  • 天河wap网站建设公司债务优化是什么意思
  • 深圳建站哪家专业百度搜索关键词设置
  • 网站logo图怎么做武汉seo哪家好
  • 计算机网站建设维护的基本知识怎么在百度上发布信息广告
  • 做网站月入7000网店推广的方式
  • 一个网站有个前端后端怎么做武汉网站建设公司
  • 广州市人民政府网站英文seo兼职
  • 网站seo网络优化公司百度提交入口网址截图
  • 打电话推销好还是做网站推广好福州百度推广开户
  • 专业做商铺的网站网游推广员
  • 高端品牌网站建设有哪些注意事项下载百度免费
  • 公司建网站软件百度应用商店下载
  • 公司网站首页设计青岛网站制作seo
  • 衡阳网站建设icp备百度搜索引擎推广步骤
  • 鄞州区住房和城乡建设局网站网址外链平台
  • 网站群集建设百度站长链接提交
  • 建网站简易软件搜索引擎优化的简称