1
有誰知道是否可以從角色的startup.cmd訪問ServiceConfiguration.cscfg?Azure:從startup.cmd訪問ServiceConfiguration.cscfg?
ServiceConfiguration.cscfg是否放置在角色的物理VM上的任何位置?
謝謝!
有誰知道是否可以從角色的startup.cmd訪問ServiceConfiguration.cscfg?Azure:從startup.cmd訪問ServiceConfiguration.cscfg?
ServiceConfiguration.cscfg是否放置在角色的物理VM上的任何位置?
謝謝!
創建一個觸發PowerShell腳本啓動腳本:
powershell.exe Set-ExecutionPolicy Unrestricted
powershell.exe .\mypsscript.ps1 >> ..\startup-tasks-log.txt 2>>..\startup-tasks-error-log.txt
然後,在PowerShell腳本,您可以輕鬆地訪問RoleEnvironment類(配置值以及):
[Reflection.Assembly]::LoadWithPartialName("Microsoft.WindowsAzure.ServiceRuntime")
$roleInstanceId = [Microsoft.WindowsAzure.ServiceRuntime.RoleEnvironment]::CurrentRoleInstance.Id
$appTitle = [Microsoft.WindowsAzure.ServiceRuntime.RoleEnvironment]::GetConfigurationSettingValue("AppTitle")
等
我知道這個答案是舊的,但有人可以幫助我使用它?你如何將PowerShell的東西帶入啓動腳本? – 2012-09-13 13:33:05
你應該從批處理文件中調用它,如下所述:http://blog.smarx.com/posts/windows-azure-startup-tasks-tips-tricks-and-gotchas – 2012-10-11 11:48:01