6
votes

I have the most simple example of the webjobs SDK, that is supposed to trigger when a new file is put on an input blob container and copy it to another one.

Below are the code and the App.config, with the account name and key redacted to XXX intentionally.

The problem is that when I run this locally, I get the exception below.

System.InvalidOperationException was unhandled HResult=-2146233079 Message=Microsoft Azure WebJobs SDK Dashboard connection string is missing or empty.

I have already tried:

  1. Creating a JobHostConfiguration variable and setting the connection string there. I get the same error.
  2. Publishing this to an actual Azure WebJob, and put the connection string in the Azure Portal website configuration, I get the exact same error in the Job logs. Note that the job mode was set to Continuous and the AlwaysOn option was set on the webapp.
  3. Putting the connection information in an appSetting entry instead of in connectionStrings. Saw it on a blog post somewhere, still did not work.
  4. Using UseDevelopmentStorage in the connection string, but it complains that the Azure Storage Emulator is not supported.

I just installed the latest version of the SDK today (2.9, I believe?). This is a new machine and I'm just learning Azure and WebJobs, so it's not like I've gotten a lot of complex scenarios working on this machine before.

At this point, I'm at a loss. Any help is greatly appreciated, thank you.

Code:

using Microsoft.Azure.WebJobs;
using System.IO;

namespace TestWebJob1
{
    class Program
    {
        static void Main(string[] args)
        {
            JobHost host = new JobHost();
            host.RunAndBlock();
        }

        public static void CopyCopy([BlobTrigger("testinput/{name}")] TextReader input, [Blob("testoutput/{name}")] out string output)
        {
            output = input.ReadToEnd();
        }
    }
}

App.config

<?xml version="1.0" encoding="utf-8"?>
<configuration>
    <startup> 
        <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6.1" />
    </startup>
  <connectionStrings>
    <add name="AzureWebJobsDashboard" connectionString="DefaultEndpointsProtocol=https;AccountName=XXXX;AccountKey=XXX" />
  </connectionStrings>
</configuration>
2

2 Answers

8
votes

Very silly. Turns out there are 2 connection strings needed. Dashboard AND Storage.

Since the only difference in the exception text is the word Storage vs Dashboard, I was not really reading the whole text and didn't realize until a read a few more blog posts that there are 2 connections needed.

Adding the connection string with name AzureWebJobsStorage fixed the error.

1
votes

You can try setting the connection string explicitly when you configure the JobHostConfiguration object.

class Program
{
    static void Main()
    {
        //Configure JobHost
        var storageConnectionString = "your_connection_string"; //You can load this from .config file obviously
        var config = new JobHostConfiguration(storageConnectionString);

        //Pass configuration to JobJost
        var host = new JobHost(config);
        // The following code ensures that the WebJob will be running continuously
        host.RunAndBlock();
    }
}

Hope this helps.