2012-06-04 106 views
0

我正在使用本答案中描述的技術: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中放置一個斷點,並且命中斷點。一切看起來不錯,除了找到意見。有什麼建議麼?

+0

所以,我現在幾乎已經放棄了在單獨的項目中查看視圖的想法。把控制器放在不同的項目中很好,很容易,所以我會堅持下去。但是我現在要把這個問題留下來。希望有一天有人會有一天想出一個平滑,簡單,可維護,並通過完成這一工具的方式支持。 –

+1

在類似的情況下,我通過添加具有Read特權的IIS_IUSRS來編輯虛擬目錄的權限。 視圖開始被發現。 – Almas

+0

你有沒有試過Almas的建議?它爲我工作。我有一個有點不同的設置 - vb.net webforms項目作爲主要項目與剃鬚刀mvc3 c#項目從內部引用和視圖作爲虛擬文件夾。添加上面提到的權限(我原先放了IUSR)修正了問題 – Mihailo

回答

0

確保您的視圖標記爲嵌入式資源。

+0

似乎沒有什麼區別。 –