Asp.net Core + IIS 8.5: 未找到视图 'Index'
Asp.net Core + IIS 8.5 : The view 'Index' was not found
在 IIS 8.5 上部署的应用程序,Asp.net 核心
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
我知道'~/'指的是approot;
我的VS2015结构:
Tested/Checked:
- .UseContentRoot(Directory.GetCurrentDirectory()) 在 Program.cs
- 服务器上 IIS_IUSRS 用户帐户的所有权限
自定义视图位置扩展器:
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
在 project.json
中的发布选项中添加 "UI"
"publishOptions": {
"include": [
"wwwroot",
"UI",
"YourCertificateName.pfx",
"web.config"
]}
精度:"UI" 指包含我的观点的 'root' 文件夹。您必须将它们全部包含在 "publishOptions" 中(根视图文件夹)才能导出。
在 IIS 8.5 上部署的应用程序,Asp.net 核心
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
我知道'~/'指的是approot;
我的VS2015结构:
Tested/Checked:
- .UseContentRoot(Directory.GetCurrentDirectory()) 在 Program.cs
- 服务器上 IIS_IUSRS 用户帐户的所有权限
自定义视图位置扩展器:
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
在 project.json
中的发布选项中添加 "UI""publishOptions": {
"include": [
"wwwroot",
"UI",
"YourCertificateName.pfx",
"web.config"
]}
精度:"UI" 指包含我的观点的 'root' 文件夹。您必须将它们全部包含在 "publishOptions" 中(根视图文件夹)才能导出。