Use connectionstring in WebJob on Azure

无人久伴 提交于 2019-11-30 02:02:23

问题


Is there an easy way to share connection string between website and WebJob on Azure? The only way I found already is to read web.config from console application, but it doesn't look good for me.


回答1:


The Azure website and WebJob are sharing the application settings/connection strings set on the Azure portal. So assuming you're using a .NET console application as a WebJob, just use ConfigurationManager to get your connection string (to help test it, just have your app.config have the same connection string key).

If you're not using .NET console application, the connection strings are in the environment so you can just query for them.



来源:https://stackoverflow.com/questions/23791383/use-connectionstring-in-webjob-on-azure

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!