Azure Web应用程序ConfigurationManager.AppSettings为null

时间:2017-03-22 19:59:32

标签: azure

我尝试学习一些Azure网络应用程序的东西但是......

我将一个应用程序设置添加到部署槽并尝试通过ConfigurationManager.AppSettings [“TEST”]读取它,但它是空的。

Azure portal

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Configuration;

namespace WebApplication1
{
    public partial class WebForm1 : System.Web.UI.Page
    {

        protected void Page_Load(object sender, EventArgs e)
        {
            string text = ConfigurationManager.AppSettings["TEST"];
            Button1.Text = text;
        }
    }
}

1 个答案:

答案 0 :(得分:0)

Configuration Manager仅允许您访问本地配置文件,以便访问使用CloudConfigurationManager类或RoleEnvironment类所需的Azure配置设置。

可以找到更多详细信息http://swiftmailer.org/downloads/archive