是否可以在部署腳本中的AzureWebsites中設置默認appsettings鍵/值?在Kudu Azure網站部署中設置默認appsetting
我知道這是可能的web.config,但我想設置在AzureWebsites配置選項卡動態 例如。
key:dbname value:%Websitename%-db
key:deploymentTime value=%time%
是否可以在部署腳本中的AzureWebsites中設置默認appsettings鍵/值?在Kudu Azure網站部署中設置默認appsetting
我知道這是可能的web.config,但我想設置在AzureWebsites配置選項卡動態 例如。
key:dbname value:%Websitename%-db
key:deploymentTime value=%time%
您可以使用applicationHost.xdt動態地添加應用程序設置如下所述: https://github.com/projectkudu/kudu/wiki/Xdt-transform-samples
如果你把一個applicationHost.xdt
文件下的'd:\家\網站」目錄。
這個文件的內容是:
<?xml version="1.0"?> <configuration xmlns:xdt="http://schemas.microsoft.com/XML-Document-Transform"> <system.webServer> <runtime xdt:Transform="Insert" > <environmentVariables> <add name="appsetting_{SETTING NAME}" value="{SETTING VALUE}" /> </environmentVariables> </runtime> </system.webServer> </configuration>
注意:一個需要注意的是,把這個文件後,您需要重新啓動該網站,以便使其生效。
有沒有辦法自動化'applicationHost.xdt'文件的部署? – BenV 2014-11-18 00:27:42
您可以使用自定義部署腳本:http://blog.amitapple.com/post/38417491924/azurewebsitecustomdeploymentpart1/ – 2014-11-18 17:37:04
這個appSettings如何在以後使用?僅用於診斷嗎? – 2014-10-31 06:42:02