A few comments:
- You don't need the
while(true)
statement.RunAndBlock
already has a while loop inside and it will block there. - You don't need Manually retrieve the table. You can bind to a table as shown in the samples here
- You can bind to the storage account, you don't need to manually read the connection string from the configuration file and create the instance.
Here is an example of binding to storage account:
public static void ProcessQueueMessage([QueueInput("blogqueue")] string json, CloudStorageAccount)
{
...
}
This is a wild guess but, from your code, it seems that the storage connection string is stored in StorageConnectionString
in the config file. The JobHost
expects either (1) the connection strings for runtime and data to be stored in AzureJobsData
and AzureJobsRuntime
(as described here) or (2) pass the connection string as parameter to the JobHost
constructor. I think this is the reason of the crash.