简体   繁体   English

Azure WebJob在部署后是否会查看app.config

[英]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: 下面是它的工作原理:

  • 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). Azure不会就地运行WebJob,而是将其复制到临时文件夹(以避免在运行时将其锁定到位)。
  • 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. Azure会侦听WebJob文件中的文件更改,因此,如果您修改配置文件,Azure会再次复制/转换文件并重新启动WebJob。

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.

相关问题 如何为Azure WebJob加密App.config? - How should I encrypt App.config for an Azure WebJob? 在 Kudu 中找不到 Azure webjob 的 App.config - Can't find Azure webjob's App.config in Kudu 控制台应用程序转换为 Azure Webjob 无法写入 app.config 中提到的文件位置 - Console app converted to Azure Webjob not able to wite to a file location mentioned in app.config 是否可以针对不同的发布配置文件为Azure WebJob进行App.config转换? - Is it possible to have App.config transforms for an Azure WebJob for different publish profiles? 使用ConfigurationManager访问v3.5 Azure WebJob中的App.config - Using ConfigurationManager to access App.config in a v3.5 Azure WebJob 为什么我需要在Azure管理门户中而不是在我的WebJob的App.config中为WebJobs配置连接字符串? - Why do I need to configure connection strings for WebJobs in Azure Management Portal rather than in the App.config of my WebJob? 组合的Azure Web角色和辅助角色项目在部署时未看到app.config - Combined Azure web role and worker role project not seeing app.config when deployed 天蓝色项目msbuild不复制app.config - azure project msbuild is not copying app.config Azure App.Config SharedAccessSignature错误 - Azure App.Config SharedAccessSignature Error 部署后,Azure Web Jobs和Azure App Service API是否从相同的“应用程序设置”中读取? - Does Azure Web Jobs and Azure App Service API read from the same “Application Settings” once deployed?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM