簡體   English   中英

Azure 函數,“System.Private.CoreLib:值不能為 null。(參數‘path1’)。值不能為 null。(參數‘provider’)”

[英]Azure Functions, "System.Private.CoreLib: Value cannot be null. (Parameter 'path1'). Value cannot be null. (Parameter 'provider')"

我正在運行 Azure 功能/核心工具 3.x,在我的 Gradle(版本 4.6)Java(JDK 1.8)項目中,帶有 azure 功能應用程序。 我在 localhost:7071 的 api/devices 上有一個 GET 端點,我試圖訪問它,但我在運行azureFunctionsRun 時不斷出錯。

當我運行 azureFunctionsPackage 時,它似乎工作正常。 當我運行 azureFunctionsRun 時,我收到下面發布的錯誤。 當我曾經在 azure 核心工具 2.x 上時,我很高興使用命令“func start”,一切都完美無缺。 我有帶有樣板版本和 ExtensionBundles 腳本的 host.json 文件和帶有連接字符串的 local.settings.json 用於我的 Azure Web 作業存儲:

Azure Functions Core Tools found.
Starting running Azure Functions...
Executing command: cmd.exe /c cd /D C:\git\edge_bootstrap_ms\build\azurefunctions\edge-bootstrap-ms && func host start

              %%%%%%
             %%%%%%
        @   %%%%%%    @
      @@   %%%%%%      @@
   @@@    %%%%%%%%%%%    @@@
 @@      %%%%%%%%%%        @@
   @@         %%%%       @@
     @@      %%%       @@
       @@    %%      @@
            %%
            %

Azure Functions Core Tools (3.0.2106 Commit hash: 5431fca4f603bf9446d7dd2d5f96a43b5f69b5cb)
Function Runtime Version: 3.0.13107
[3/18/2020 8:56:57 PM] FUNCTIONS_WORKER_RUNTIME set to java. Skipping WorkerConfig for language:node
[3/18/2020 8:56:57 PM] FUNCTIONS_WORKER_RUNTIME set to java. Skipping WorkerConfig for language:powershell
[3/18/2020 8:56:57 PM] FUNCTIONS_WORKER_RUNTIME set to java. Skipping WorkerConfig for language:python
[3/18/2020 8:56:57 PM] Starting worker process:C:\Program Files\Java\jdk1.8.0_241\bin\java  -XX:+TieredCompilation -XX:TieredStopAtLevel=1 -noverify -Djava.net.preferIPv4Stack=true -jar "C:\Users\KBRV37\AppData\Roaming\npm\node_modules\azure-functions-core-tools\bin\workers\java\azure-functions-java-worker.jar" --host 127.0.0.1 --port 61509 --workerId 9ff09cf4-42d8-4e1a-b66e-8058754fe61a --requestId 123c617a-61e1-4b3a-98d8-13b6a5eff6c1 --grpcMaxMessageLength 134217728
[3/18/2020 8:56:57 PM] C:\Program Files\Java\jdk1.8.0_241\bin\java process with Id=10984 started
[3/18/2020 8:56:57 PM] [INFO] {Application.main}: Azure Functions Java Worker  version [ 1.5.2-SNAPSHOT]
[3/18/2020 8:56:58 PM] [INFO] {MessageHandler.handle}: Message generated by "StartStream.Builder"
[3/18/2020 8:56:59 PM] Building host: startup suppressed: 'False', configuration suppressed: 'False', startup operation id: '078289ce-7cd5-4f2f-924b-40696702867a'
[3/18/2020 8:56:59 PM] Reading host configuration file 'C:\git\edge_bootstrap_ms\build\azurefunctions\edge-bootstrap-ms\host.json'
[3/18/2020 8:56:59 PM] Host configuration file read:
[3/18/2020 8:56:59 PM] {
[3/18/2020 8:56:59 PM]   "version": "2.0",
[3/18/2020 8:56:59 PM]   "extensionBundle": {
[3/18/2020 8:56:59 PM]     "id": "Microsoft.Azure.Functions.ExtensionBundle",
[3/18/2020 8:56:59 PM]     "version": "[1.*, 2.0.0)"
[3/18/2020 8:56:59 PM]   }
[3/18/2020 8:56:59 PM] }
[3/18/2020 8:56:59 PM] Reading functions metadata
[3/18/2020 8:56:59 PM] 3 functions found
[3/18/2020 8:56:59 PM] Looking for extension bundle Microsoft.Azure.Functions.ExtensionBundle at (null)
[3/18/2020 8:56:59 PM] Fetching information on versions of extension bundle Microsoft.Azure.Functions.ExtensionBundle available on https://functionscdn.azureedge.net/public/ExtensionBundles/Microsoft.Azure.Functions.ExtensionBundle/index.json
[3/18/2020 8:56:59 PM] A host error has occurred during startup operation '078289ce-7cd5-4f2f-924b-40696702867a'.
[3/18/2020 8:56:59 PM] System.Private.CoreLib: Value cannot be null. (Parameter 'path1').
Value cannot be null. (Parameter 'provider')
Application is shutting down...
[3/18/2020 8:56:59 PM] Initialization cancellation requested by runtime.
[3/18/2020 8:56:59 PM] Shutting down language worker channels for runtime:java
[3/18/2020 8:56:59 PM] Stopping host...
[3/18/2020 8:56:59 PM] Host shutdown completed.
:azureFunctionsRun FAILED
1 actionable task: 1 executed

FAILURE: Build failed with an exception.

主機.json:

{
  "version": "2.0",
  "extensionBundle": {
    "id": "Microsoft.Azure.Functions.ExtensionBundle",
    "version": "[1.*, 3.0.0)"
  }
}

local.settings.json:

{
  "IsEncrypted": false,
  "Values": {
    "AzureWebJobsStorage": "DefaultEndpointsProtocol=https;AccountName=myAzureAccountName;AccountKey=myAzureAccountKeyString==",
    "FUNCTIONS_WORKER_RUNTIME": "java"
  }
}

我在 DI 服務的構造函數中使用的“local.setting.json”中缺少配置值。 通過添加這些值解決了我的問題。 希望你也是。

我能夠通過卸載 coretools 3.x 並重新安裝來解決這個問題。 或者就像我在這篇文章中所說的那樣,如果您很懶惰,可以單擊 azurefunctinosrun 失敗時顯示在控制台中的 extensionsbundle 鏈接,它會在您再次運行 azurefunctions 后立即工作。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM