Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Does Azure WebJob look at the app.config once deployed

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

like image 953
Daniel van Heerden Avatar asked Jun 13 '16 05:06

Daniel van Heerden


People also ask

What is difference between WebJob and Azure function?

Azure Functions offers more developer productivity than Azure App Service WebJobs does. It also offers more options for programming languages, development environments, Azure service integration, and pricing. For most scenarios, it's the best choice.

What is WebJob in Azure?

WebJobs is a feature of Azure App Service that enables you to run a program or script in the same instance as a web app, API app, or mobile app. There is no additional cost to use WebJobs. You can use the Azure WebJobs SDK with WebJobs to simplify many programming tasks.

Which of the following is not true about WebJobs?

Explanation : A. Incorrect: WebJobs can be triggered by both queue messages and blobs.


2 Answers

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.
like image 118
David Ebbo Avatar answered Sep 19 '22 08:09

David Ebbo


Mark Seeman elaborates on this:

As far as I can tell, it attempts to read configuration settings in this prioritized order:

1.Try to find the configuration value in the Web Site's >online configuration (see below).

2.Try to find the configuration value in the .cscfg file.

3.Try to find the configuration value in the app.config file or web.config file.

(Read the whole investigation here: http://blog.ploeh.dk/2014/05/16/configuring-azure-web-jobs/)

like image 24
Indigo8 Avatar answered Sep 21 '22 08:09

Indigo8