Azure WebJobs SDK 基础

Basic of Azure WebJobs SDK

我想了解 Azure WebJobs SDK 上的 JobHostConfiguration。 我在哪里可以找到配置?在 app.config 上吗?

JobHostConfiguration 如何识别这是否是 IsDevelopment? 我在 app.config

上找不到它

JobHostConfiguration 读取什么配置?

谢谢

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

是的,它在 app.config 文件中。您也可以在此文件中手动添加一些新配置。

How can JobHostConfiguration identified this is IsDevelopment or not ?

这取决于 JobHost 是否在开发环境中 运行ning。默认值为假。如果你希望它是真的,你可以在 app.config 文件中添加以下代码,让 JobHost 运行 在一个 开发环境。您可以阅读此 article 以了解有关此配置的更多信息。

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

结果是这样的:

What config that JobHostConfiguration read ?

可以读取很多配置信息,比如Azure Web Jobs的连接字符串。您可以单击“新建项目”>“云”>选择“Azure WebJob”来创建一个 Web 作业来尝试。

读取 app.config 文件中的连接字符串:

<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>