Use connectionstring in WebJob on Azure

前端 未结 1 1491
梦谈多话
梦谈多话 2021-01-04 10:58

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 does

1条回答
  •  栀梦
    栀梦 (楼主)
    2021-01-04 11:12

    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.

    0 讨论(0)
提交回复
热议问题