有没有人知道是否可以从角色的startup.cmd访问ServiceConfiguration.cscfg?
ServiceConfiguration.cscfg是否放置在角色的物理虚拟机上的任何位置?
谢谢!
发布于 2011-06-10 19:31:44
创建触发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")等。
https://stackoverflow.com/questions/6302958
复制相似问题