gpt4 book ai didi

c# - 南希.ViewEngines.ViewNotFoundException : Unable to locate view 'Index'

转载 作者:行者123 更新时间:2023-11-30 18:25:48 30 4
gpt4 key购买 nike

我知道这个问题是在一个月前提出的,但从未得到回答。我的程序正常启动,但在返回 View["Index", blogPost] 后找不到 Index.cshtml 并引发异常。

Get["/"] = parameters =>
{
var blogPost = new BlogPost
{
Id = 1,
Title = "Test",
Content = "Lorem ipsum...",
Tags = { "c#", "aspnetmvc", "nancy" }
};

return View["Index", blogPost];
};

异常(exception):

Nancy.RequestExecutionException: Oh noes! ---> Nancy.ViewEngines.ViewNotFoundException: Unable to locate view 'Index' Currently available view engine extensions: sshtml,html,htm,cshtml,vbhtml Locations inspected: views/Home/Index-de-DE,views/Home/Index,Home/Index-de-DE,Home/Index,views/Index-de-DE,views/Index,Index-de-DE,Index`

最佳答案

如果给我的基督徒的答案对您没有帮助,就像对我没有帮助一样,还有一个替代问题/解决方案。另一种方法是确保您创建的文件在编译时被复制到输出目录。您可以在属性选项卡下查看它,如下所示

Like its shown here

关于c# - 南希.ViewEngines.ViewNotFoundException : Unable to locate view 'Index' ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29623313/

30 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com