简体   繁体   English

如何查看 Azure 应用服务 web 应用的最终 appSettings 值?

[英]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 门户(在“开发工具”部分下)中使用以下刀片:

在此处输入图像描述

Console安慰

In order to see the file, you may use type command, eg:为了查看该文件,您可以使用type命令,例如:

type web.config

Advanced Tools高级工具

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应用服务编辑器

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

kudo wiki 工藤Wiki

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

相关问题 如何配置不在<appSettings> web.config 的部分? - How do I configure an Azure App Service setting that isn't in the <appSettings> section of the web.config? 如何在已部署的Azure Web App中通过PowerShell访问appsettings.json? - How can I access appsettings.json via PowerShell in a deployed Azure Web App? Azure 应用服务应用程序设置不覆盖 appsettings.json 值 - Azure App Service Application Settings not overriding appsettings.json values 如何在Web App Service中使用“Azure文件存储”? - How can I use “Azure File Storage” with Web App Service? 如何在运行时从 React 应用程序访问 Azure Web App AppSettings - How can you access Azure Web App AppSettings from a React app at run time 轻松导出Azure Web App的AppSettings? - Easy way to export AppSettings for an Azure Web App? Azure Web应用程序ConfigurationManager.AppSettings为空 - Azure web app ConfigurationManager.AppSettings is null 如何在Azure应用服务-&gt; Web应用(Linux)中启用php扩展 - How can I enable php extension in Azure app service -> web app (Linux) 我如何远程调试部署在 azure 应用程序服务上的 asp.net 核心 web 应用程序 - How can i remotely debug an asp.net core web app deployed on an azure app service 如何使用应用服务环境在 Azure 上设置私有 Web 应用 - How can i set up a private web app on Azure using an App Service Environment
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM