c# - 由于绑定错误,Azure Webjob 无法启动
问题描述
我有一个网络作业,它应该从 Azure 队列中读取,并对找到的有效负载做一些事情。我遇到的问题是网络作业无法启动,这是错误
[02/17/2021 15:40:11 > e80592:INFO] [15:40:10 ERR] 错误索引方法“Functions.ProcessStudentPerfQueueMessages”[02/17/2021 15:40:11 > e80592:INFO] Microsoft。 Azure.WebJobs.Host.Indexers.FunctionIndexingException:错误索引方法“Functions.ProcessStudentPerfQueueMessages”[2021 年 2 月 17 日 15:40:11 > e80592:信息] ---> System.InvalidOperationException:无法绑定参数“消息”输入“学生信息”。 [02/17/2021 15:40:11 > e80592: INFO] 在 Microsoft.Azure.WebJobs.Host.Bindings.Data.ClassDataBindingProvider`1.TryCreateAsync(BindingProviderContext context) 在 C:\projects\azure-webjobs-sdk- rqm4t\src\Microsoft.Azure.WebJobs.Host\Bindings\Data\ClassDataBindingProvider.cs:line 35 [02/17/2021 15:40:11 > e80592: INFO] 在 Microsoft.Azure.WebJobs.Host.Bindings.Data .DataBindingProvider.TryCreateAsync(BindingProviderContext context) 在 C:\projects\azure-webjobs-sdk-rqm4t\src\Microsoft.Azure.WebJobs.Host\Bindings\Data\DataBindingProvider.cs:line 41 [02/17/2021 15: 40:11 > e80592: INFO] 在 Microsoft.Azure.WebJobs.Host.Bindings.CompositeBindingProvider.TryCreateAsync(BindingProviderContext context) 在 C:\projects\azure-webjobs-sdk-rqm4t\src\Microsoft.Azure.WebJobs.Host\ Bindings\BindingProviders\CompositeBindingProvider.cs:第 23 行 [02/17/2021 15:40:11 > e80592: INFO] 在 Microsoft.Azure.WebJobs.Host.Indexers.FunctionIndexer.IndexMethodAsyncCore(MethodInfo method, IFunctionIndexCollector index, CancellationToken cancellationToken) 在 C:\projects\azure- webjobs-sdk-rqm4t\src\Microsoft.Azure.WebJobs.Host\Indexers\FunctionIndexer.cs:line 196 [02/17/2021 15:40:11 > e80592: INFO] 在 Microsoft.Azure.WebJobs.Host.Indexers C:\projects\azure-webjobs-sdk-rqm4t\src\Microsoft.Azure.WebJobs.Host\Indexers\FunctionIndexer.cs 中的 .FunctionIndexer.IndexMethodAsync(MethodInfo 方法,IFunctionIndexCollector 索引,CancellationToken cancelToken):第 149 行 [02/17 /2021 15:40:11 > e80592: INFO] --- 内部异常堆栈跟踪结束 --- [02/17/2021 15:40:11 > e80592: INFO] 在 Microsoft.Azure.WebJobs.Host.Indexers .FunctionIndexer.IndexMethodAsync(MethodInfo 方法,C:\projects\azure-webjobs-sdk-rqm4t\src\Microsoft.Azure.WebJobs.Host\Indexers\FunctionIndexer.cs:line 157 [02/17/2021 15:40:11 中的 IFunctionIndexCollector 索引,CancellationToken cancelToken) e80592:C:\projects\azure-webjobs-sdk-rqm4t\src\Microsoft.Azure.WebJobs 中 Microsoft.Azure.WebJobs.Host.Indexers.FunctionIndexer.IndexTypeAsync(类型类型,IFunctionIndexCollector 索引,CancellationToken 取消令牌)中的信息]。 Host\Indexers\FunctionIndexer.cs:line 85 [02/17/2021 15:40:13 > e80592: INFO] [15:40:13 FTL] Web 作业启动失败C:\projects\azure-webjobs-sdk-rqm4t\src\Microsoft.Azure.WebJobs.Host\Indexers\FunctionIndexer.cs:line 85 [02/17/2021 15:40:13] 中的 IFunctionIndexCollector 索引,CancellationToken cancelToken) e80592: INFO] [15:40:13 FTL] Web 作业启动失败C:\projects\azure-webjobs-sdk-rqm4t\src\Microsoft.Azure.WebJobs.Host\Indexers\FunctionIndexer.cs:line 85 [02/17/2021 15:40:13] 中的 IFunctionIndexCollector 索引,CancellationToken cancelToken) e80592: INFO] [15:40:13 FTL] Web 作业启动失败
这是代码
public class Functions
{
private readonly IService _service;
public Functions(IService service)
{
_service = service;
}
public async Task ProcessStudentPerfQueueMessages([QueueTrigger("studentperf")] StudentMessage message)
{
await new StudentPerfQueueProcessor(_pascoService).ProcessMessage(message));
}
目前队列中没有任何消息。如果我更改StudentMessage
为 a string
,则 webjob 在 Azure 中成功启动。这是一个网络核心网络作业。请帮忙。
解决方案
这里是学生班
public class StudentMessage
{
public int StudentId { get; set; }
public int SubjectId { get; set; }
public StudentForm Form { get; set; }
public Dictionary<int, AnswerStatus> QuestionAnswerStatus { get; set; }
public string Message { get; set; }
public DateTime Date { get; set; }
}
Doris Lv 让我想到了StudentMessage
课堂。Message
我决定在 StudentMessage 和 bam 中注释掉该属性!它成功启动了。一定是 Newtonsoft.json 的东西。
推荐阅读
- ios14 - 是否可以在没有完整应用程序的情况下构建 App Clip?
- r - 将时间序列分组为分层数据
- symfony5 - 在新用户的表单中使用密码编码器
- r - 在用户定义函数中调用 colnames()
- mysql - 如何只选择一个值的前 2 个寄存器?
- javascript - 如何解决这种意外混合的“>>>”和“&”运算符警告?
- c# - 列表
- > 达到内存限制
- cypress - 赛普拉斯:赛普拉斯无法找到边缘
- python - 在本地运行 Pyspark 以访问 S3 中的 parquet 文件错误:“无法从链中的任何提供商加载 AWS 凭证”
- powershell - 如何使用 powershell 自定义日期获得与某个日期的年月差?