c# - 部署到生产时找不到索引 View ?

标签 c# asp.net asp.net-mvc view windows-xp

尝试将 MVC 应用程序部署为现有 ASP.NET 3.5 应用程序(非 MVC)的子应用程序时遇到问题。错误是:

The view 'index' or its master could not be found. The following locations were searched:
~/Views/employment/index.aspx
~/Views/employment/index.ascx
~/Views/Shared/index.aspx
~/Views/Shared/index.ascx

The application works fine when running inside of visual studio web developer express SP1 and also works when configured as the top level web site.

I'm developing under XP (IIS 6ish) so I've already configured the wildcard mappings etc. The MVC app is configured as a virtual folder directly underneath the root web site (http://localhost/ROHAS where ROHAS is the virtual folder pointing to my MVC solution). I've also tried adding routes in the global.asax.cs to compensate for the sub application's virtual path:

routes.MapRoute("NetPortal",    // Route name<br>
            "localhost/rohas/{controller}/{action}/{id}");

还有

routes.MapRoute("NetPortal",    // Route name<br>
            "rohas/{controller}/{action}/{id}");

我什至尝试添加另一个虚拟文件夹,该文件夹仅指向我的 MVC 解决方案中的 Views 文件夹。

但是,我仍然收到上面详细说明的错误。

最佳答案

您必须在使用 MVC 项目的网站中创建一个虚拟目录,名称为“Views”,它指向 MVC 项目中的 Views 目录。确保在 IIS 管理器中创建仅具有“读取”访问权限的 VD,并确保您没有该 VD 的应用程序。

(VD -> 属性 -> 确保应用程序部分呈灰色)

关于c# - 部署到生产时找不到索引 View ?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1378907/

相关文章:

c# - 如何从访问者那里获取 IP 地址(如果在代理后面也是如此)

C# mvc 图片上传调整大小服务器端

asp.net-mvc - 用于 KendoUI 自动完成的开箱即用 MVC ModelBinder

c# - 如何将 '\' 更改为 '/'

asp.net - 如何调查 ASP.net 应用程序上的 SQL Server 超时错误?

javascript - Greybox 关闭后刷新父页面

asp.net-mvc - 使用 LINQ 和 ASP.NET MVC 的存储过程多表输出

c# - 字符串表列表 c#

c# - ASP.NET 的高级可视化选项

c# - 如何将自定义属性添加到 WPF 用户控件