Does Azure WebJob look at the app.config once deployed

Daniel van Heerden picture Daniel van Heerden · Jun 13, 2016 · Viewed 10.4k times · Source

I have a Web site running on Azure App Services. It has a WebJob that deploys with it, and thus gets put in it's App_data folder once deployed.

If I FTP to the wwwroot/app_data folder of my site once deployed, the app.config file has none of the configured settings that I set up in the "Application Settings Blade" in the Azure portal. The settings are changed in my web.config for the Website though.

The most curious thing is that when I run the WebJob, the log output indicates that the correct settings are being used!!

So as per my title, does the WebJob use the App.Settings file once deployed or does it use some kind of in-memory copy of the app-settings from the azure portal, or does it use what is in the web.config of the website?

Just to pre-emt a possible question, I know that the app.settings gets renamed to myappname.exe.config

Answer

David Ebbo picture David Ebbo · Jun 13, 2016

Here is how it works:

  • Azure doesn't run your WebJob in-place, but instead copies it to a temp folder (to avoid locking it in-place when it runs).
  • As part of this copying process, the App Settings are transformed in the temp files. That's why you don't see the changes in the config file.
  • Azure listens to file changes in your WebJob files, so if you modify your config file, Azure copies/transforms the files again and restarts the WebJob.