我有一个 Azure Function v2 应用程序,最初的目标是 netcoreapp2.1
。
然后我有一个 Startup.cs
类,用 [ assembly: WebJobsStartup(typeof(Startup))]
注释来设置 dependency injection ,但它没有在 extensions.json
文件中注册 Startup
。
这是在构建
期间发生的。 Publish has another issue at the moment .
当我将项目文件中的 TargetFramework
更改为 netstandard2.0
时,它成功地将 Startup
添加到 extensions.json
:
{
"extensions":[
{ "name": "AzureStorage", "typeName":"Microsoft.Azure.WebJobs.Extensions.Storage.AzureStorageWebJobsStartup, Microsoft.Azure.WebJobs.Extensions.Storage, Version=3.0.1.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"},
{ "name": "Startup", "typeName":"MyApp.Functions.Startup, MyApp.Functions, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null"}
]
}
虽然我没有确切的理由以 netcoreapp2.1
为目标,但我很好奇为什么它不起作用,因为 v2 是 changed to target .Net Core by default .
最佳答案
关于azure - Azure Functions v2 中的 WebJobsStartup 在定位 netcoreapp2.1 时不起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53062309/