简体   繁体   English

asp.net 内核中 web.config 文件的替代品是什么

[英]What is the alternate of web.config file in asp.net core

I am started working on asp.net core web application and there is no web.config file in this project.我开始研究 asp.net 核心 web 应用程序,并且该项目中没有 web.config 文件。 Here is appsettings.json file though.这是 appsettings.json 文件。 I don't know where to store confidential information (like we store username and passwords of domain in web.config file in.Net Framework).我不知道在哪里存储机密信息(比如我们将域的用户名和密码存储在.Net Framework 中的 web.config 文件中)。 Is it safe to Store confidential data in appsettins.json file?将机密数据存储在 appettins.json 文件中是否安全?

Yes appsettings.json is like web.config for ASP.NET Core. 是appsettings.json就像ASP.NET Core的web.config。 It's for storing non secretive data. 它用于存储非秘密数据。 But there are multiple ways to configure your app, eg environment variables, command line arguments, as well as appsettings.json. 但是有多种方法可以配置您的应用程序,例如环境变量,命令行参数以及appsettings.json。 You can also configure each environment with this file. 您还可以使用此文件配置每个环境。

You should not store secrets like usernames, passwords or API keys here, as this file gets checked into source control and you might leak these to other parties. 您不应在此处存储密码,如用户名,密码或API密钥,因为此文件会被检入源代码管理中,您可能会将这些密码泄露给其他方。 You can use User Secrets (only in development) or Azure Key Vault for secretive settings. 您可以使用用户密钥(仅在开发中)或Azure Key Vault进行秘密设置。

This is a big topic so it's better to check the docs on this, and see which provider(s) works best for your scenario. 这是一个很大的主题,所以最好检查一下这个文档 ,看看哪个提供程序最适合您的场景。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM