[英]Does Azure WebJob look at the app.config once deployed
I have a Web site running on Azure App Services. 我有一个在Azure App Services上运行的网站。 It has a WebJob that deploys with it, and thus gets put in it's App_data folder once deployed.
它有一个随它部署的WebJob,因此一旦部署就会被放入它的App_data文件夹中。
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. 如果我在部署后FTP到我的站点的wwwroot / app_data文件夹,则app.config文件没有我在Azure门户中的“应用程序设置刀片”中设置的配置设置。 The settings are changed in my web.config for the Website though.
我的web.config中的设置已更改为网站。
The most curious thing is that when I run the WebJob, the log output indicates that the correct settings are being used!! 最奇怪的是,当我运行WebJob时,日志输出表明正在使用正确的设置!
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? 因此,根据我的标题,WebJob是否在部署后使用App.Settings文件,或者是否使用来自azure门户的应用程序设置的某种内存副本,或者它是否使用web.config中的内容。网站?
Just to pre-emt a possible question, I know that the app.settings gets renamed to myappname.exe.config 为了预先提出一个可能的问题,我知道app.settings被重命名为myappname.exe.config
Here is how it works: 下面是它的工作原理:
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).
1.尝试在网站的>在线配置中找到配置值(见下文)。
2.Try to find the configuration value in the .cscfg file.
2.尝试在.cscfg文件中查找配置值。
3.Try to find the configuration value in the app.config file or web.config file.
3.尝试在app.config文件或web.config文件中查找配置值。
(Read the whole investigation here: http://blog.ploeh.dk/2014/05/16/configuring-azure-web-jobs/ ) (阅读整个调查: http : //blog.ploeh.dk/2014/05/16/configuring-azure-web-jobs/ )
David Ebbo answer is perfectly right. David Ebbo的回答是完全正确的。
Just wanted to state that you can also run web jobs in place by a using a parameter in settings.job: 只是想声明您还可以通过在settings.job中使用参数来运行Web作业:
{
"is_in_place": true
}
Details can be found in Kudu docs: 详细信息可以在Kudu文档中找到:
https://github.com/projectkudu/kudu/wiki/WebJobs#webjob-working-directory https://github.com/projectkudu/kudu/wiki/WebJobs#webjob-working-directory
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.