gpt4 book ai didi

deployment - 由于启动脚本,Azure 部署失败

转载 作者:行者123 更新时间:2023-12-02 07:32:02 24 4
gpt4 key购买 nike

我将按照 ServiceDefinition.csdef 中的以下内容启动启动脚本

<Startup>
<Task commandLine="Microsoft.WindowsAzure.Caching\ClientPerfCountersInstaller.exe install" executionContext="elevated" taskType="simple" />
<Task commandLine="startup.cmd" executionContext="elevated" taskType="simple" />
</Startup>

startup.cmd 文件是

@echo off
REM StartupLog.txt can be found at (E or F):\approot\bin

Echo Copying MyUtil to system root >> StartupLog.txt 2>&1
copy /y MyUtil.exe %SystemRoot% >> StartupLog.txt 2>&1
IF ERRORLEVEL 1 GOTO ErrorExit

REM It's ok if the next fails, the task may not be scheduled 1st time
Echo Trying to delete MyUtil from scheduler >> StartupLog.txt 2>&1
schtasks /Delete /F /TN "MyUtil" >> StartupLog.txt 2>&1

Echo Adding MyUtil to Scheduler >> StartupLog.txt 2>&1
schtasks /Create /SC MINUTE /MO 2 /SD 11/01/2012 /TN "MyUtil" /TR %SystemRoot%\MyUtil.exe >> StartupLog.txt 2>&1
IF ERRORLEVEL 1 GOTO ErrorExit >> StartupLog.txt 2>&1
GOTO End

:ErrorExit
REM Report the date, time, and ERRORLEVEL of the error.
%ERRORLEVEL% >> StartupLog.txt 2>&1
DATE /T >> StartupLog.txt 2>&1
TIME /T >> StartupLog.txt 2>&1
ECHO An error occurred during startup. ERRORLEVEL = %ERRORLEVEL% >> StartupLog.txt 2>&1
ECHO ----------------------------------------------------------- >> StartupLog.txt 2>&1
EXIT /B 1

:End
ECHO Exiting at end with 0 >> StartupLog.txt 2>&1
ECHO ----------------------------------------------------------- >> StartupLog.txt 2>&1
EXIT /B 0

(E: 或 F:)\approot\bin 中的错误是:

Copying MyUtil to system root                                                        
1 file(s) copied.
Trying to delete MyUtil from scheduler
SUCCESS: The scheduled task "MyUtil" was successfully deleted.
Adding MyUtil to Scheduler
ERROR: No mapping between account names and security IDs was done.

(43,4):LogonType:'1' is not recognized as an internal or external command,
operable program or batch file.

如果我在 RDPing 到 WebRole 后运行startup.cmd 文件,那么任务就会很好地添加到调度程序中。由于某种原因,部署总是失败。有谁知道如何解决这一问题?我恢复到 OSVersion=2,直到可以解决此问题。

最佳答案

原因可能是执行脚本的用户(还)没有 AppData 目录。您可以尝试将这些添加到启动任务的顶部吗?

md "%~dp0appdata"
reg add "hku\.default\software\microsoft\windows\currentversion\explorer\user shell folders" /v "Local AppData" /t REG_EXPAND_SZ /d "%~dp0appdata" /f

关于deployment - 由于启动脚本,Azure 部署失败,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13329822/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com