是否可以从应用程序本身更改网站的应用程序设置?
这不是日常操作,而是自助服务重新配置选项.非开发人员可以更改特定设置,这应该会导致重新启动,就像我可以在网站配置页面上手动执行(应用程序设置部分)
解决方法
一旦我找到合适的lib,它就不那么难了,Microsoft Azure Web Sites Management Library.
var credentials = GetCredentials(/*using certificate*/); using (var client = new WebSiteManagementClient(credentials)) { var currentConfig = await client.WebSites.GetConfigurationAsync(webSpaceName,webSiteName); var newConfig = new WebSiteUpdateConfigurationParameters { ConnectionStrings = null,DefaultDocuments = null,HandlerMappings = null,Metadata = null,AppSettings = currentConfig.AppSettings }; newConfig.AppSettings[mySetting] = newValue; await client.WebSites.UpdateConfigurationAsync(webSpaceName,webSiteName,newConfig); }