我想了解 Azure WebJobs SDK 上的 JobHostConfiguration。
我在哪里可以找到配置?它在 app.config 上吗?
JobHostConfiguration 如何识别这是不是 IsDevelopment ?
我在 app.config 上找不到它
JobHostConfiguration 读取什么配置?
谢谢
我在哪里可以找到配置?它在 app.config 上吗?
是的,它在 app.config 文件中。您还可以在此文件中手动添加一些新配置。
JobHostConfiguration 如何识别这是不是 IsDevelopment ?
这取决于是否JobHost正在开发环境中运行。默认值为 false。如果你希望它是真的,你可以在app.config文件中添加以下代码,让JobHost运行在
开发环境。你可以读一下这个article https://github.com/Azure/azure-webjobs-sdk/wiki/Running-Locally了解有关此配置的更多信息。
<appSettings>
<add key="AzureWebJobsEnv" value="Development"/>
</appSettings>
结果是这样的:
JobHostConfiguration 读取什么配置?
它可以读取许多配置信息,例如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>
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)