通过 ICompositeViewEngine.FindView() 解决了
public class ErrorsController : Controller
{
public IActionResult StatusCodePage(int? statusCode, [FromServices]ICompositeViewEngine compositeViewEngine)
{
bool viewExists = statusCode.HasValue &&
compositeViewEngine.FindView(ControllerContext, statusCode.Value.ToString(), true).Success;
return viewExists ? View(statusCode.Value.ToString()) : View("Default");
}
}