[英]Azure Function app Not able to run showing this error Value cannot be null. (Parameter 'provider') in java
[英]Azure function IoTHub: Error indexing method Value cannot be null. (Parameter 'connectionString')
我試圖從 Azure function 設置觸發器來讀取來自我的 IoT 中心的所有數據。 為此,我遵循了本教程。
在本地設置中設置連接字符串后,當我嘗試啟動 function 時,出現以下錯誤:
“functionName”function 出錯:Microsoft.Azure.WebJobs.Host:錯誤索引方法“Functions.functionName”。 Microsoft.WindowsAzure.Storage:值不能為 null。 (參數'connectionString')。
我嘗試將端點添加為服務總線,或直接添加為主機名,但兩者都有相同的錯誤。
為了進一步澄清,我將展示我的實現:
local.settings.json
{
"IsEncrypted": false,
"Values": {
"AzureWebJobsStorage": "",
"FUNCTIONS_WORKER_RUNTIME": "java",
"app_trigger_hub_name": "{hubname}",
"app_trigger_connection": "Endpoint=sb://{hubname}.servicebus.windows.net/;SharedAccessKeyName={accessKey};SharedAccessKey={sharedKey}",
}
}
Azure Function 觸發器
@FunctionName("functionName")
public void eventHubProcessor(
@EventHubTrigger(name = "functionName", eventHubName = "%app_trigger_hub_name%",
connection = "app_trigger_connection") String message,
final ExecutionContext context) {
context.getLogger().info(message);
}
編輯
經過一些試驗和錯誤后,我設法使用服務總線獲得連接,但仍然無法正常工作。 現在,當我啟動 function 時,出現以下錯誤:
function 'Functions.function' 的偵聽器無法啟動。 Microsoft.Azure.EventHubs.Processor:獲取 EventHub PartitionIds 列表時遇到錯誤。 System.Private.CoreLib:提供節點名或服務名,或未知。
首先,您使用的是 IoTHub 還是 EventHub? 在 C# 中,您使用 iothub 屬性:“IoTHubTrigger”。
例如:
@FunctionName("ehprocessor")
public void eventHubProcessor(
@IoTHubTrigger(name = "msg",
eventHubName = "myeventhubname",
connection = "myconnvarname") String message,
final ExecutionContext context )
{
context.getLogger().info(message);
}
using IoTHubTrigger = Microsoft.Azure.WebJobs.EventHubTriggerAttribute;
對於 connectionString,您可以使用“事件中心兼容端點”,您可以在 azure 門戶的“內置端點”下找到該端點。
我現在看到了您編輯的部分,您是否嘗試在本地清空您的 eventthub 容器? “azure-webjobs-eventhub”? 為我解決了許多奇怪的錯誤。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.