部署應用上IIS 8.5,Asp.net芯Asp.net核心+ IIS 8.5:視圖 '索引' 未找到
3的應用,前端,API和登錄(在同一地點);
所有3個都在VS2015的IIS Express中完成工作;
前端(僅HTML/AngularJS)& API在IIS 8.5
但對於登錄完美的工作(IdentityServer4):
InvalidOperationException: The view 'Index' was not found. The following locations were searched:
- ~/UI/Home/Views/Index.cshtml
- ~/UI/SharedViews/Index.cshtml
據我所知, '〜/' 是指批准;
我的VS2015結構:
測試/檢查:
- .UseContentRoot(Directory.GetCurrentDirectory())在Program.cs中
- 所有的權限IIS_IUSRS用戶帳戶的服務器上
CustomViewLocationExpander:
public class CustomViewLocationExpander : IViewLocationExpander { public IEnumerable<string> ExpandViewLocations(ViewLocationExpanderContext context, IEnumerable<string> viewLocations){ yield return "~/UI/{1}/Views/{0}.cshtml"; yield return "~/UI/SharedViews/{0}.cshtml"; } public void PopulateValues(ViewLocationExpanderContext context) { } }
我可以自由地訪問在 'wwwroot的' 只有JS /圖片/ CSS的所有內容
我就這一個毫無頭緒。
您是否檢查您是否部署了視圖?你可以分享你的project.json的樣子嗎? –
我忘了在project.json的publishOptions元素中的「wwwroot」旁邊添加「UI」文件夾 – DavidT