Basic of Azure WebJobs SDK

天大地大妈咪最大 提交于 2019-12-07 07:15:12

问题


I would like to know about JobHostConfiguration on Azure WebJobs SDK. Where I can find the config ? is it on app.config ?

How can JobHostConfiguration identified this is IsDevelopment or not ? I cannot find it on app.config

What config that JobHostConfiguration read ?

Thank You


回答1:


Where I can find the config ? is it on app.config ?

Yes, it is in app.config file. You also could add some new configs manually in this file.

How can JobHostConfiguration identified this is IsDevelopment or not ?

It depends on whether the JobHost is running in a Development environment. The default value is false. If you want it to be true, you could add the following code in app.config file to let the JobHost run in a Development environment. And you could read this article to learn more about this configuration.

<appSettings>
    <add key="AzureWebJobsEnv" value="Development"/>
</appSettings>

The result is like this:

What config that JobHostConfiguration read ?

It could read many information of config, such as the connection string of Azure Web Jobs. You could click New Project>Cloud>choose Azure WebJob to create a Web Jobs to try.

Read connection string in app.config file:

<connectionStrings>
    <!-- The format of the connection string is "DefaultEndpointsProtocol=https;AccountName=NAME;AccountKey=KEY" -->
    <!-- For local execution, the value can be set either in this config file or through environment variables -->
    <add name="AzureWebJobsDashboard" connectionString="your storage connection string" />
    <add name="AzureWebJobsStorage" connectionString=" your storage connection string " />
  </connectionStrings>



来源:https://stackoverflow.com/questions/49022216/basic-of-azure-webjobs-sdk

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