gpt4 book ai didi

asp.net - MVC3 应用程序忽略 Razor .cshtml 扩展名

转载 作者:行者123 更新时间:2023-12-02 15:21:01 25 4
gpt4 key购买 nike

我第一次尝试使用 Razor Web 项目运行 MVC3。该项目是由 S#arp Architecture 生成的,因此可能缺少一些接线。

包含 Razor 条目的事实上的 web.config 已在 Views 文件夹下创建。这是 ~/

的错误
[InvalidOperationException: The view 'Index' or its master was not found or no view engine supports the searched locations. The following locations were searched:
~/Index.aspx
~/Index.ascx
~/Views/Home/Index.aspx
~/Views/Home/Index.ascx
~/Views/Shared/Index.aspx
~/Views/Shared/Index.ascx]

知道缺少什么吗?谢谢。

最佳答案

添加

ViewEngines.Engines.Add(new RazorViewEngine());

Application_Start()

在 Global.asax.cs

成功了

关于asp.net - MVC3 应用程序忽略 Razor .cshtml 扩展名,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5153763/

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