Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/unit-testing/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Asp.net mvc 4 viewstart.cshtml中的布局文件路径将附加到视图路径_Asp.net Mvc 4 - Fatal编程技术网

Asp.net mvc 4 viewstart.cshtml中的布局文件路径将附加到视图路径

Asp.net mvc 4 viewstart.cshtml中的布局文件路径将附加到视图路径,asp.net-mvc-4,Asp.net Mvc 4,查看此错误中的路径: 异常详细信息:System.Web.HttpException:布局页面 在以下路径中找不到“~Areas/SongTracker/Views/Shared/_homeloayout.cshtml”: “~/Areas/SongTracker/Views/Home/~Areas/SongTracker/Views/Shared/\u homeloayout.cshtml” 这是视图->主目录中的_viewstart.cshtml文件 @{ Layout = "~Areas

查看此错误中的路径:

异常详细信息:System.Web.HttpException:布局页面 在以下路径中找不到“~Areas/SongTracker/Views/Shared/_homeloayout.cshtml”: “~/Areas/SongTracker/Views/Home/~Areas/SongTracker/Views/Shared/\u homeloayout.cshtml”

这是视图->主目录中的_viewstart.cshtml文件

@{ 
Layout = "~Areas/SongTracker/Views/Shared/_HomeLayout.cshtml";
}
为什么要将布局文件路径附加到视图目录路径?请注意,视图目录位于MVC4项目的一个区域中

这是global.asax.cs中的“我的注册路由”功能(此处为默认内容):


好的,我知道了。我错过了~之后的一段时间,就像这样:

"~/Areas/SongTracker/Views/Shared/_HomeLayout.cshtml"
"~/Areas/SongTracker/Views/Shared/_HomeLayout.cshtml"