2014-08-27 39 views
0

我在共享文件夹的子文件夹中有几个页面。MVC 5发布时的文件夹结构问题

我渲染视图页面上theese的局部视图这样的:

@Html.Partial("Scripts/Case_Action") 
@Html.Partial("Scripts/Case_Action_Comments") 
@Html.Partial("Scripts/Case_History") 

当我调试这个完美的作品,但是当我发布网站现在不找到文件。

当我调试的URL看起来像这样:http://localhost:44300/Case/id,当我发布的URL是这样的:http://xx.xxx.xx.xx/FOLDER/Case/id其中xxx *是IP。

那么我怎么能得到这个工作,当我调试和当我发布?

这里是错误:

The partial view 'Scripts/Case_Action' was not found or no view engine supports the searched locations. The following locations were searched: 
~/Views/Case/Scripts/Case_Action.aspx 
~/Views/Case/Scripts/Case_Action.ascx 
~/Views/Shared/Scripts/Case_Action.aspx 
~/Views/Shared/Scripts/Case_Action.ascx 
~/Views/Case/Scripts/Case_Action.cshtml 
~/Views/Case/Scripts/Case_Action.vbhtml 
~/Views/Shared/Scripts/Case_Action.cshtml 
~/Views/Shared/Scripts/Case_Action.vbhtml 
+0

发布到什么? – 2014-08-27 11:37:11

+0

试试这个'@ Html.Partial(“Scripts/Case_Action_Comments.cshtml”)'在别人也是 – Amit 2014-08-27 11:38:33

+0

@AmitAgrawal会做什么?视图引擎显然试图找到'.cshtml'文件。 – Stijn 2014-08-27 11:40:59

回答

1

你的观点必须有Content构建行动,否则他们将不会被包含在一个发布。检查你的意见的属性:

screenshot of Visual Studio

+0

视图或部分视图或两者兼而有之? – stibay 2014-08-27 11:45:05

+0

@stibay都。视图没有被定义为“全部”或“部分”,单个视图可以被渲染为两者。 – Stijn 2014-08-27 11:46:49

+0

啊完美。这解决了这个问题 – stibay 2014-08-27 11:50:34