[英]How can I view the final appSettings values on an Azure App Service web app?
I have an ASP.NET MVC app deployed to Microsoft Azure App Service and am having some trouble with the appSettings and connectionStrings values.我有一个 ASP.NET MVC 应用程序部署到 Microsoft Azure 应用程序服务,我在 appSettings 和 connectionStrings 值方面遇到了一些问题。
I have some values set in the web.config and some values overriding them in the Application Settings tab of the App Service.我在 web.config 中设置了一些值,并在 App Service 的“应用程序设置”选项卡中设置了一些值来覆盖它们。 I want to quickly and easily view the final values to check that the settings are being picked up correctly.我想快速轻松地查看最终值以检查设置是否正确。
How can I do this?我怎样才能做到这一点?
Note: I've tried using az webapp config appsettings list
but this only seems to bring back what is configured in the Application Settings of the App Service and not the merged results of combining with web.config.注意:我已经尝试使用az webapp config appsettings list
但这似乎只能带回应用服务的应用程序设置中配置的内容,而不是与 web.config 结合的合并结果。
No Azure API will return values that include settings that come from your web.config file. Azure的任何API都不会返回包含来自web.config文件的设置的值。
The only way to get this is to ask the config system within your own runtime. 唯一的方法就是在自己的运行时中询问配置系统。 eg Use code along these lines: 例如,使用以下代码:
foreach (string name in ConfigurationManager.AppSettings)
{
string val = ConfigurationManager.AppSettings[name];
...
}
foreach (ConnectionStringSettings settings in ConfigurationManager.ConnectionStrings)
{
string connStr = settings.ConnectionString;
string provider = settings.ProviderName;
...
}
This will give you the effective values that are applied to your app. 这将为您提供应用于您的应用的有效值。
You may also use the following blades in Azure Portal (under Development Tools section):您还可以在 Azure 门户(在“开发工具”部分下)中使用以下刀片:
In order to see the file, you may use type
command, eg:为了查看该文件,您可以使用type
命令,例如:
type web.config
This points to the Kudu service .这指向Kudu 服务。
You may see files deployed when navigating to Debug Console > Choose either CMD or PowerShell. Then navigate to your config directory (eg site/wwwroot) and choose to either download or edit file.导航到调试控制台时,您可能会看到已部署的文件 > 选择 CMD 或 PowerShell。然后导航到您的配置目录(例如 site/wwwroot)并选择下载或编辑文件。
App Service Editor is a relatively new tool in Azure toolset. App Service Editor 是 Azure 工具集中的一个相对较新的工具。 Default view is a list of files, so you can browse all hosted files, including configuration ones.默认视图是文件列表,因此您可以浏览所有托管文件,包括配置文件。
You can view all of your runtime appSettings, connection strings and environment variables (and more..) using azure KUDU SCM . 您可以使用azure KUDU SCM查看所有运行时appSettings,连接字符串和环境变量(等等)。 if your application address is " https://app_name.azurewebsites.net " you can access it in the address " https://app_name .scm .azurewebsites.net" or from azure portal 如果您的应用程序地址为“ https://app_name.azurewebsites.net ”,则可以在地址“ https:// app_name .scm .azurewebsites.net”或通过azure门户对其进行访问
With kudo REST API , you can get the settings, delete or post them in this address https://app_name.scm.azurewebsites.net/api/settings 使用kudo REST API ,您可以获取设置,将其删除或发布到此地址https://app_name.scm.azurewebsites.net/api/settings
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.