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 –
布魯斯提出的解決方案正是我所期待的。現在一切正常。謝謝。 –