【发布时间】:2015-03-03 07:35:15
【问题描述】:
目标:创建环境变量,通知启动任务是在计算模拟器还是在云中运行。
错误:
错误 124 XML 规范无效:命名空间“http://schemas.microsoft.com/ServiceHosting/2008/10/ServiceDefinition”中的元素“Startup”在命名空间“http://schemas.microsoft.com/ServiceHosting/2008/10/ServiceDefinition”中具有无效的子元素“环境”。预期的可能元素列表:命名空间“http://schemas.microsoft.com/ServiceHosting/2008/10/ServiceDefinition”中的“任务”。 D:\PrasadP_Workspace\FlexPathCapital\flexpathazurecloudmigration\flexpathazurecloudmigration\FlexPath.Cloud\ServiceDefinition.csdef 11 8 FlexPath.Cloud
启动任务:
<Startup>
<Task commandLine="startup.cmd" executionContext="elevated" taskType="simple" />
<environment>
<!--create the environment variable that informs the startup task whether it is running
in the compute emulator or in the cloud. "%computeemulatorrunning%"=="true" when
running in the compute emulator, "%computeemulatorrunning%"=="false" when running
in the cloud.-->
<variable name="computeemulatorrunning">
<roleinstancevalue xpath="/roleenvironment/deployment/@emulated" />
</variable>
</environment>
</Startup>
startup.cmd:
之后,我将检查 cmd 文件中的环境以执行我的任务。
REM Check if this task is running on the compute emulator
IF "%ComputeEmulatorRunning%" == "true" (
REM This task is running on the compute emulator. Perform tasks that must be run only in the compute emulator.
) ELSE (
REM This task is running on the cloud. Perform tasks that must be run only in the cloud.
)
【问题讨论】:
标签: azure