检查 ViewComponent 类是否有名为 InvokeAsync 或 Invoke 的公开方法。例如:
public class MyCustomViewComponent : ViewComponent
{
public async Task
或
public class MyCustomViewComponent : ViewComponent { public IViewComponentResult Invoke() { // Your implementation } }
确保你的 ViewComponent 类只有这两个公共方法之一。