0

I've created a web job using the webjobs sdk that is linked to my web application. Well it isn't anymore (I removed the webjobs-list.json file from the web app project), because when it was linked, it just copied the source code files into the websites' app-data folder, not the bin folder/binaries/exe. But now that my web job is deployed from visual studio online to azure with my website, and tries to run, it's not reading the connection strings (AzureWebJobsStorage and AzureWebJobsDashboard) from the connection strings in my web application's settings in the azure portal. It looks for them in the config file that is deployed with the exe that is generated from compiling the webjob. If I manually put those strings in that config and check in, and redploy it will use them from there, so it's not checking the portal at all (even though my web app is running fine using what is defined in the portal). I thought that all web jobs were supposed to look for connection strings in the azure portal first? That isn't happening at all for me. Has anyone else experienced this? Could it have something to do with how it's deployed by visual studio online?

Part of the error getting logged for the webjob process when trying to start:

Microsoft.Azure.WebJobs.Host.Indexers.FunctionIndexingException: Error indexing method 'Functions.ProcessTestQueueMessage' ---> System.InvalidOperationException: Microsoft Azure WebJobs SDK 'Storage' connection string is missing or empty. The Microsoft Azure Storage account connection string can be set in the following ways: [04/01/2017 02:27:40 > ceef22: INFO] 1. Set the connection string named 'AzureWebJobsStorage' in the connectionStrings section of the .config file in the following format , or [04/01/2017 02:27:40 > ceef22: INFO] 2. Set the environment variable named 'AzureWebJobsStorage', or [04/01/2017 02:27:40 > ceef22: INFO] 3. Set corresponding property of JobHostConfiguration. [04/01/2017 02:27:40 > ceef22: INFO] at Microsoft.Azure.WebJobs.Host.Executors.StorageAccountParser.ParseAccount(String connectionString, String connectionStringName, IServiceProvider services)

Also, the only way I could get this to really deploy was to remove the webjobs-list.json file from the properties folder in the web project. I know I'm not supposed to do that, that everything should just work and deploy with that in there, but when I left it in there, it wouldn't copy the binaries/bin/executable files into the App_Data\Jobs\continuous[webjob] folder on the website...it would literally copy all of the source code\files for the web job project into there (which of course wouldn't work/run, since it's just code, not an exe). After removing that webjobs-list.json file, and then adding a second task to my release to find the [webjob].zip file from the build, then it would copy just the binaries and executable into the App_Data\Jobs\continuous[webjob] folder. Maybe this is just an issue with trying to build and release from visual studio online, and it doesn't handle web job deployment well...not sure, I haven't been able to find a lot of information on setting that up to deploy a web job with a web app.

1 Answer 1

1

Normally, this should just work. The flow is:

  • The WebJobs exe doesn't run in-place, but first gets copied to a temp folder
  • As part of that copying process, if any of the AppSettings & Conn Strings in the foo.exe.config file are set as Azure settings, they get replaced (only in the temp copy, not under App_Data).

Can you make sure that you are deploying both your foo.exe and foo.exe.config?

Update: as we found on chat, the problem was that you had a typo in the name of the connection string in Azure.

Sign up to request clarification or add additional context in comments.

9 Comments

Ok, so I left just the keys in [webjob project].exe.config, queued up another build on the website, and deployed, and from what I can tell, it's still not checking for the conn strings in the portal, because the web job is failing when it starts saying that the connection string for AzureWebJobStorage has no value, even though I do have it in the portal. ....I wonder if something is possibly configured incorrectly in either my build (from visual studio online), or in my release definition.
Here is the .exe.config conn strings: <connectionStrings> <add name="AzureWebJobsDashboard" connectionString="" /> <add name="AzureWebJobsStorage" connectionString="" /> </connectionStrings>
Try using Kudu Console to check if your config file was indeed deployed.
Yep, I see it in there, and it's just the connection string with the key and empty value.
The build process should not be relevant if the right files are getting deployed.
|

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.