在MVC3中为多项目区域配置虚拟目录

时间:2012-06-04 13:04:15

标签: asp.net-mvc-3 iis-express

我正在使用此答案中描述的技术:https://stackoverflow.com/a/7167198/22399在MVC3中设置多项目区域。但是,我的问题似乎是配置IIS Express,而不是技术本身。

我在第7步中做错了(使用IIS Express。)我一直收到一条错误,说它无法找到视图(我的测试区域被调用&#34; Sample&#34;)这是错误:< / p>

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>

其中,从谷歌搜索的一切,它应该是正确的。我有post构建过程复制DLL就好了。我可以在SampleController中放置一个断点,并且断点被击中。除了找到意见外,一切看起来都不错。有什么建议吗?

1 个答案:

答案 0 :(得分:0)

确保您的观点被标记为嵌入资源。