如何从Hangfire返回返回值 [英] How to return a return value from Hangfire
问题描述
我注意到Hangfire仪表板中的此字段用于成功完成的工作:
I noticed this field in the Hangfire Dashboard for a succeeded job:
我很乐意在其中添加一些数据,以便为我提供有关工作职责的更多信息.
I would love to shove some data in there, to give me more information about what the job did.
我该怎么做?
我已经搜索过google,检查了Hangfire文档等,但是没有运气-可能是因为在这种情况下搜索结果"是一个非常棘手的关键字.
I have searched google, checked the Hangfire documentation etc, but with no luck - probably because "result" is a very tricky keyword to search for in this context.
推荐答案
结果"字段显示方法返回的输出/结果.
The "Result" field displays the output/result your method returns.
您可以返回字符串或对象,Hangfire会将其转换为JSON.
You can return a string or object and Hangfire will convert it to JSON.
您的结果"字段包含序列化错误,Hangfire无法序列化返回的对象,但是没有任何代码,我无法进一步帮助您.
Your "Result" field contains a serialization error, Hangfire is failing to serialize the returned object but without any code I cannot help you further.
请参见下面的示例屏幕截图.
Please see example screenshots below.
这篇关于如何从Hangfire返回返回值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!