问题描述
我想了解Azure WebJobs SDK上的JobHostConfiguration.在哪里可以找到配置?是在app.config上吗?
JobHostConfiguration如何确定这是否是IsDevelopment?我在app.config上找不到它
JobHostConfiguration读取什么配置?
谢谢
是的,它在app.config文件中.您也可以在此文件中手动添加一些新配置.
这取决于 JobHost 是否在开发环境中运行.默认值为false.如果您希望它为真,则可以在app.config文件中添加以下代码,以使JobHost在开发环境.您可以阅读
它可以读取许多配置信息,例如Azure Web Jobs的连接字符串.您可以单击新建项目">云">选择"Azure WebJob"以创建要尝试的Web作业.
读取app.config文件中的连接字符串:
< connectionStrings><!-连接字符串的格式为"DefaultEndpointsProtocol = https; AccountName = NAME; AccountKey = KEY"-><!-对于本地执行,可以在此配置文件中或通过环境变量设置值->< add name ="AzureWebJobsDashboard" connectionString =您的存储连接字符串"/>< add name ="AzureWebJobsStorage" connectionString =您的存储连接字符串"/></connectionStrings>
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
Yes, it is in app.config file. You also could add some new configs manually in this file.
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 aDevelopment 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:
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>
这篇关于Azure WebJobs SDK的基础的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!