第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號安全,請及時綁定郵箱和手機立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

使用VirtualPathProvider從DLL加載ASP.NET MVC視圖

使用VirtualPathProvider從DLL加載ASP.NET MVC視圖

MYYA 2019-10-25 10:05:27
基于此處的問題并使用此處找到的代碼,我試圖將作為嵌入式資源的視圖加載到一個單獨的DLL項目中,原始問題的作者說他已經(jīng)成功做到了這一點-但我無法將其作為看來MVC視圖引擎正在攔截請求,并且仍在查看該視圖的文件系統(tǒng)。例外:Server Error in '/' Application.The view 'Index' or its master could not be found. The following locations were searched:~/Views/admin/Index.aspx~/Views/admin/Index.ascx~/Views/Shared/Index.aspx~/Views/Shared/Index.ascx~/App/Views/admin/Index.aspx~/App/Views/admin/Index.ascx~/App/Views/Shared/Index.aspx~/App/Views/Shared/Index.ascx 我使用的CustomViewEngine是Rob Connery的/ App結構,如下所示:public class CustomViewEngine : WebFormViewEngine    {         public CustomViewEngine()         {             MasterLocationFormats = new[] {                 "~/App/Views/{1}/{0}.master",                 "~/App/Views/Shared/{0}.master"                 };             ViewLocationFormats = new[] {                 "~/App/Views/{1}/{0}.aspx",                 "~/App/Views/{1}/{0}.ascx",                 "~/App/Views/Shared/{0}.aspx",                 "~/App/Views/Shared/{0}.ascx"                 };             PartialViewLocationFormats = ViewLocationFormats;         }    }這是我的路線:    routes.IgnoreRoute("{resource}.axd/{*pathInfo}");    routes.MapRoute("Home", "", new {controller = "Page", action = "Index", id = "Default"});    routes.MapRoute("Default", "Page/{id}", new { controller = "Page", action = "Index", id = "" });    routes.MapRoute("Plugins", "plugin/{controller}/{action}", new { controller = "", action = "Index", id = "" });    routes.MapRoute("Error", "{*url}", new { controller = "Error", action = "ResourceNotFound404" });在我AssemblyResourceProvider,我檢查,看看是否路徑開始~/plugin/,然后使用該dll文件名公約plugin.{controller}.dll有什么建議么?更新:當路由的發(fā)言請求http://localhost/plugin/admin到達VirtualFileProvider時,它的末尾沒有任何視圖。因此,在VirtualFileProvider的Open方法~/plugin/admin中,應該按照~/plugin/admin/Index.aspx上面我的路線中的定義傳遞虛擬路徑。我是否弄亂了路線,還是期待發(fā)生這種情況?
查看完整描述

3 回答

?
當年話下

TA貢獻1890條經(jīng)驗 獲得超9個贊

內置的WebFormsViewEngine使用VirtualPathProviders,因此,如果您編寫并注冊了VPP,則無需對視圖引擎進行任何更改。


查看完整回答
反對 回復 2019-10-25
?
慕森卡

TA貢獻1806條經(jīng)驗 獲得超8個贊

第一次FileExists調用發(fā)生在控制器運行之前,并且必須返回false,否則IIS會嘗試將其用作靜態(tài)文件。當控制器請求視圖時,對實際aspx文件的請求稍后出現(xiàn)。

查看完整回答
反對 回復 2019-10-25
  • 3 回答
  • 0 關注
  • 555 瀏覽

添加回答

舉報

0/150
提交
取消
微信客服

購課補貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動學習伙伴

公眾號

掃描二維碼
關注慕課網(wǎng)微信公眾號