Noe*_*ams 2 iis azure azure-web-roles
我为Azure网站创建了一个启动任务,执行以下操作:
我已经创建了一个执行这些任务的powershell脚本.
我在服务定义中设置了启动元素
<Startup>
<Task commandLine="MyStartup.cmd" executionContext="elevated" taskType="simple">
</Task>
</Startup>
Run Code Online (Sandbox Code Playgroud)
到目前为止都很好.
但是,我发现,相当晚,:
在启动过程的启动任务阶段,可能无法完全配置IIS,因此特定于角色的数据可能不可用.
我认为这意味着运行powershell脚本时,IIS上可能不存在该网站.我已经测试了脚本,确定它失败了,因为它无法在IIS上找到虚拟目录.
我的问题是:有没有办法确保在IIS上创建网站后运行powershell脚本?
请注意,Microsoft.WindowsAzure.ServiceRuntime.RoleEntryPoint.OnStart如果可能,我真的不想使用.
提前致谢.
我接着是@kwill的建议并创建了以下内容:
电源外壳:
while(!($myWeb = Get-Website -name "*MyWeb*")){
Write-Host "Website not installed. Waiting 30 seconds..."
Start-Sleep 30
}
# Proceed with installation
和配置
<Task commandLine="MyBackground.cmd" executionContext="elevated" taskType="background">
</Task>
Run Code Online (Sandbox Code Playgroud)
这有效.
| 归档时间: |
|
| 查看次数: |
1151 次 |
| 最近记录: |