部署到生产时无法找到索引视图? [英] Can not find index view when deploying to production?

查看:143
本文介绍了部署到生产时无法找到索引视图?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在尝试部署一个MVC应用程序与现有的ASP.NET 3.5应用程序(非MVC)的子应用程序时,我打了一个问题。该错误是:

I'm hit a problem when attempting to deploy a MVC app as a sub-application of an existing ASP.NET 3.5 app (non MVC). The error is:


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

Visual Studio的Web开发人员EX preSS SP1内部运行时,应用程序工作正常,也当配置为顶级网站的作品。

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.

我在XP(IIS 6ish),所以我已经配置了通配符映射等MVC应用程序被配置为正下方根网站的虚拟文件夹( HTTP下发展://本地主机/ ROHAS 其中ROHAS是虚拟文件夹指向我的MVC解决方案)。我也试着在Global.asax.cs中添加路由,以补偿子应用程序的虚拟路径:

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解决方案视图文件夹中其他虚拟文件夹。

I've even tried adding another virtual folder that just points to the Views folder in my MVC solution.

不过,我仍然得到上面详述的错误。

However, I still get the error detailed above.

推荐答案

您有您选择使用MVC项目中,名称为意见,这点在你的MVC视图目录下创建的网站虚拟目录项目。确保只创建一个VD只有读在IIS管理器的访问,并同时确保您的的有VD成为应用。

You have to create a Virtual Directory in the website youre using the MVC project in, with the name 'Views', which points to the Views directory in your MVC project. Make sure to just create a VD with only 'Read' access in IIS Manager, and make also sure you do not have a Application for the VD.

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

(VD -> Properties -> Make sure the application section is greyed out)

这篇关于部署到生产时无法找到索引视图?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆