0
我试图运行PowerShell脚本作为Azure的Web作业(简单的一个附带的WebApp),负责创建PDF文件,并上传该文件到Azure的Blob存储。当文件创建成功有使用下面的命令文件上传过程中出现错误:用PowerShell脚本天青WebJob上传文件到Azure的Blob存储
$pdfFileName = $reportId + ".pdf";
$storageAccountName = "MY-STORE"
$storageAccountKey = "MY-KEY"
$containerName = "_MY_CONTAINER"
$fullFileName = $PSScriptRoot + "\" + $pdfFileName
$ctx = New-AzureStorageContext -StorageAccountName $storageAccountName -StorageAccountKey $storageAccountKey
Set-AzureStorageBlobContent -File "$fullFileName" -Container $containerName -Blob $pdfFileName -Context $ctx -Force
正如我有以下消息的结果显示在Azure的网上工作日志(在库杜门户)。
[11/15/2016 15:20:24 > 89499f: ERR ] Set-AzureStorageBlobContent : Win32 internal error "The handle is invalid" 0x6
[11/15/2016 15:20:24 > 89499f: ERR ] occurred while reading the console output buffer. Contact Microsoft Customer
[11/15/2016 15:20:24 > 89499f: ERR ] Support Services.
[11/15/2016 15:20:24 > 89499f: ERR ] At
[11/15/2016 15:20:24 > 89499f: ERR ] D:\local\Temp\jobs\triggered\ddd\orgmoz1g.dqi\generateAndUploadReports.ps1:53
[11/15/2016 15:20:24 > 89499f: ERR ] char:3
[11/15/2016 15:20:24 > 89499f: ERR ] + Set-AzureStorageBlobContent -File $fullFileName -Container
[11/15/2016 15:20:24 > 89499f: ERR ] $containerName -Blo ...
[11/15/2016 15:20:24 > 89499f: ERR ] + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
[11/15/2016 15:20:24 > 89499f: ERR ] ~~~~~~
[11/15/2016 15:20:24 > 89499f: ERR ] + CategoryInfo : ReadError: (:) [Set-AzureStorageBlobContent], Ho
[11/15/2016 15:20:24 > 89499f: ERR ] stException
[11/15/2016 15:20:24 > 89499f: ERR ] + FullyQualifiedErrorId : ReadConsoleOutput,Microsoft.WindowsAzure.Command
[11/15/2016 15:20:24 > 89499f: ERR ] s.Storage.Blob.SetAzureBlobContentCommand
相同的脚本在我的本地机器上正常工作。更重要的是,当我创建webjob只是使用列出可用的模块获取-模块-ListAvailable我收到与以下者模块以及。
...
[11/15/2016 15:40:36 > 89499f: INFO] ModuleType Version Name ExportedCommands
[11/15/2016 15:40:36 > 89499f: INFO] ---------- ------- ---- ----------------
[11/15/2016 15:40:36 > 89499f: INFO] Manifest 1.4.0 Azure {Get-AzureAutomati...
...
[11/15/2016 15:40:36 > 89499f: INFO] ModuleType Version Name ExportedCommands
[11/15/2016 15:40:36 > 89499f: INFO] ---------- ------- ---- ----------------
[11/15/2016 15:40:36 > 89499f: INFO] Manifest 1.1.2 Azure.Storage {Get-AzureStorageB...
...
的原因是进度条不能在外壳的远程Web UI投射,请禁用每次刷新或导航到SCM基于Web的PS控制台。请参阅此问题:https://github.com/projectkudu/kudu/issues/2172 –
布鲁斯提出的解决方案正是我所期待的。现在一切正常。谢谢。 –