Asp.net Core + IIS 8.5: "Index" is not displayed

Deployed application in IIS 8.5, Asp.net core

3 applications, Front-end, API and Login (on one site);

All 3 work EXCELLENT in IIS express from VS2015;

Interface (html / AngularJS only) and API work fine on IIS 8.5

But for login (IdentityServer4):

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

I understand that '~ /' refers to the corresponding;

My VS2015 structure:
Visual studio 2015 project structure

Tested / Verified:

  • .UseContentRoot (Directory.GetCurrentDirectory ()) in Program.cs
  • All privileges of the IIS_IUSRS user account on the server
  • 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) { } } 

I can freely access all content on 'wwwroot' only js / images / css

I do not know how to do that.

+5
source share
1 answer

I searched over an hour before posting. Took a break and found this:

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

add "UI" to publication options in project.json

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

Accuracy: "UI" Refers to the root folder containing my views. You must include all of them (root view folders) in "publishOptions" for export.

+5
source

All Articles