我正在使用此答案中描述的技术:https : //stackoverflow.com/a/7167198/22399 在 MVC3 中设置多项目区域。不过,我的问题似乎在于配置 IIS Express,而不是技术本身。
我在步骤 7 中做错了(使用 IIS Express。)我不断收到错误消息,说它找不到视图(我的测试区域称为“示例”)这是错误:
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 Express 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 中放置一个断点,然后断点就会被命中。一切看起来都很好,除了找到风景。有什么建议么?