ビューを電子メールテンプレートとして使用する文字列としてレンダリングしようとしています。アムは、現在、この例を実装しようとしている: https://weblog.west-wind.com/posts/2012/May/30/Rendering-ASPNET-MVC-Views-to-String文字列で表示するレンダリング
ただし、コードのこの部分で問題が生じています:
public ViewRenderer(ControllerContext controllerContext = null)
{
// Create a known controller from HttpContext if no context is passed
if (controllerContext == null)
{
if (HttpContext.Current != null)
controllerContext = CreateController<ErrorController>().ControllerContext;
else
throw new InvalidOperationException(
"ViewRenderer must run in the context of an ASP.NET " +
"Application and requires HttpContext.Current to be present.");
}
Context = controllerContext;
}
Visual Studioは私に次のエラーを与えている:
"The type or namespace name 'ErrorController' could not be found (are you missing a using directive or an assembly reference?)"
Amはおそらく行方不明明らかなものだが、それが何かを見ることはできない。何か案は?
プロジェクトで 'ErrorController'を持っていますか? – NightOwl888
いいえ、これは標準化されたコントローラーであれば追加できますか、それとも作成しなければならないかわかりませんでした。 – HuwD