加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 编程开发 > asp.Net > 正文

Asp.net核心IIS 8.5:找不到视图“索引”

发布时间:2020-12-16 07:02:17 所属栏目:asp.Net 来源:网络整理
导读:在IIS 8.5,Asp.net核心上部署应用程序 3个应用程序,前端,API和登录(在同一站点上); 所有3个都在VS2015的IIS Express中完美地工作; 前端(只有html / AngularJS) API在IIS 8.5上运行良好 但是对于Login(IdentityServer4): InvalidOperationException: The vie
在IIS 8.5,Asp.net核心上部署应用程序

3个应用程序,前端,API和登录(在同一站点上);

所有3个都在VS2015的IIS Express中完美地工作;

前端(只有html / AngularJS)& API在IIS 8.5上运行良好

但是对于Login(IdentityServer4):

InvalidOperationException: The view 'Index' was not found. The following locations were searched:
 - ~/UI/Home/Views/Index.cshtml
 - ~/UI/SharedViews/Index.cshtml

我明白’?/’是指批准;

我的VS2015结构:

经测试/检查:

Program.cs中的.UseContentRoot(Directory.GetCurrentDirectory())
>服务器上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 / images / css

我对这一点毫无头绪.

解决方法

我发帖前搜索了一个多小时.休息一下,发现了这个:

https://github.com/IdentityServer/IdentityServer4.Samples/issues/23

将“UI”添加到project.json中的发布选项

"publishOptions": {
  "include": [
    "wwwroot","UI","YourCertificateName.pfx","web.config"
 ]}

精度:“UI”指包含我的视图的“root”文件夹.您必须将所有(根视图文件夹)包含在要导出的“publishOptions”中.

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读