我正在使用本答案中描述的技术:https://stackoverflow.com/a/7167198/22399在MVC3中设置多项目区域。不过,我的问题似乎是配置IIS Express,而不是技术本身。在MVC3中为多项目区域配置虚拟目录
我做错了什么步骤7我不断收到一个错误,指出它无法找到的意见(我的测试区域被称为“样品”)这里是错误(使用IIS快递。):
The view 'Index' or its master was not found or no view engine supports the searched locations. The following locations were searched:
~/Areas/Sample/Views/Index/Index.aspx<br />
~/Areas/Sample/Views/Index/Index.ascx<br />
~/Areas/Sample/Views/Shared/Index.aspx<br />
~/Areas/Sample/Views/Shared/Index.ascx<br />
~/Views/Index/Index.aspx<br />
~/Views/Index/Index.ascx<br />
~/Views/Shared/Index.aspx<br />
~/Views/Shared/Index.ascx<br />
~/Areas/Sample/Views/Index/Index.cshtml<br />
~/Areas/Sample/Views/Index/Index.vbhtml<br />
~/Areas/Sample/Views/Shared/Index.cshtml<br />
~/Areas/Sample/Views/Shared/Index.vbhtml<br />
~/Views/Index/Index.cshtml<br />
~/Views/Index/Index.vbhtml<br />
~/Views/Shared/Index.cshtml<br />
~/Views/Shared/Index.vbhtml
我的IIS表达对ApplicationHost.config设置是这样的:
<site name="Vo.MainSite" id="5">
<application path="/" applicationPool="Clr4IntegratedAppPool">
<virtualDirectory path="/" physicalPath="D:\{LONG PATH}\MainSite\MainSite\MainSite" />
</application>
<application path="/Areas/Sample" applicationPool="Clr4IntegratedAppPool">
<virtualDirectory path="/" physicalPath="D:\{LONG PATH}\Modules\SampleModule\SampleModule.Web" />
</application>
<bindings>
<binding protocol="http" bindingInformation="*:47001:localhost" />
</bindings>
</site>
其中,从我的一切谷歌搜索,它应该是正确的。我有后构建过程复制DLL就好了。我可以在SampleController中放置一个断点,并且命中断点。一切看起来不错,除了找到意见。有什么建议么?
所以,我现在几乎已经放弃了在单独的项目中查看视图的想法。把控制器放在不同的项目中很好,很容易,所以我会坚持下去。但是我现在要把这个问题留下来。希望有一天有人会有一天想出一个平滑,简单,可维护,并通过完成这一工具的方式支持。 –
在类似的情况下,我通过添加具有Read特权的IIS_IUSRS来编辑虚拟目录的权限。 视图开始被发现。 – Almas
你有没有试过Almas的建议?它为我工作。我有一个有点不同的设置 - vb.net webforms项目作为主要项目与剃须刀mvc3 c#项目从内部引用和视图作为虚拟文件夹。添加上面提到的权限(我原先放了IUSR)修正了问题 – Mihailo