简体   繁体   English

如何从 .Net Frame Asp.Net 应用程序中的 Azure App Service 配置获取连接字符串?

[英]How do I get a connection string from Azure App Service configuration in a .Net Frame Asp.Net application?

I have a standard.Net Framework Asp.Net application deployed in an Azure App Service.我在 Azure 应用服务中部署了一个标准的 .Net 框架 Asp.Net 应用程序。 Within the Azure configuration, I've set up a couple environment variables and a connection string.在 Azure 配置中,我设置了几个环境变量和一个连接字符串。

I'm able to retrieve the environment variables correctly at runtime.我能够在运行时正确检索环境变量。

var value = System.Environment.GetEnvironmentVariable("AppSettingTest");

How do you I retrieve the connection string?你如何检索连接字符串?

This application IS NOT Asp.Net Core.此应用程序不是 Asp.Net Core。 I am not using dependency injection and a startup class. I could store that value in an environment variable, but I'm led to believe connection strings stored in the App Service configuration connection string is more secure.我没有使用依赖注入和启动 class。我可以将该值存储在环境变量中,但我相信存储在 App Service 配置连接字符串中的连接字符串更安全。

Thank you Andrew Williamson and JohnB posting your discussions as answer to help other community members.感谢Andrew WilliamsonJohnB发布您的讨论作为帮助其他社区成员的答案。

Environmental variables in Azure App Service are prefixed with APPSETTING_ , SQLCONNSTR_ , etc. complete list is available here full list here Azure 应用服务中的环境变量以APPSETTING_SQLCONNSTR_等为前缀。完整列表可在此处获得完整列表在这里

暂无
暂无

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

相关问题 如何读取Service Fabric Azure App Configuration ASP.NET Core Stateless Web API? - How to read the Azure App Configuration in Service Fabric ASP.NET Core Stateless Web API? 如何手动将 ASP.NET 核心应用程序的部署版本复制到 Azure web 应用程序(应用服务) - How can I manually copy a deployment build of ASP.NET Core application to Azure web application (App Service) 从ASP.NET Core访问Azure App Service ConnectionString - Access Azure App Service ConnectionString from ASP.NET Core 如何在 ASP.NET MVC web 应用程序的 View.cshtml 中从 Azure 服务总线(队列)获取消息 - How to get messages from Azure Service Bus (Queue) in View.cshtml in ASP.NET MVC web app 无法从 Azure App 服务配置应用程序设置中读取 Azure SignalR 连接字符串 - Unable to read Azure SignalR Connection String from Azure App Service Configuration Application Settings 在 Asp.net web 应用程序部署在 azure 应用程序服务中,获取服务(.svc)端点的 404 未找到错误 - Getting 404 not found error for service(.svc) endpoints in Asp.net web application deployed on azure app service ASP.NET 核心 - Azure 活动目录身份验证 - 无法从以下位置获取配置:'System.String' - ASP.NET Core - Azure Active directory Authentication - Unable to obtain configuration from: 'System.String' ASP.net 核心 docker https on Azure 应用服务容器 - ASP.net core docker https on Azure App Service Containers 如何允许从我的 ASP.NET Core 应用程序覆盖 blob? - How do I allow the overwriting of blobs from my ASP.NET Core application? 如何使用 Azure Active Directory 在 ASP.NET Core 应用程序中获取经过身份验证的用户的名称 - How to get Name of Authenticated user in ASP.NET Core application using Azure Active Directory
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM