5

Deployed App on IIS 8.5, Asp.net core

3 apps, Front-end, API and Login (on the same site);

All 3 are working PERFECTLY in IIS express from VS2015;

The front-end (only html/AngularJS) & API are working perfectly on IIS 8.5

But for the 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 approot;

My VS2015 structure:
Visual Studio 2015 project structure

Tested/Checked:

  • .UseContentRoot(Directory.GetCurrentDirectory()) in Program.cs
  • All privileges to 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 access all content freely on 'wwwroot' only js/images/css

I'm clueless on this one.

Koopakiller
  • 2,838
  • 3
  • 32
  • 47
DavidT
  • 322
  • 3
  • 10
  • Did you check if you deployed the views? Can you share how your project.json looks like? – Kiran Jul 19 '16 at 19:36
  • I forgot to add the "UI" folder aside the "wwwroot" in the publishOptions element in the project.json – DavidT Jul 21 '16 at 00:17

1 Answers1

5

I searched for more than an hour before posting. Took a break and found this :

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

add "UI" to the publish options in project.json

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

Precision : "UI" Refers to the 'root' folder containing my views. You have to include them all (root view folders) in "publishOptions" to be exported.

DavidT
  • 322
  • 3
  • 10
  • I'm sorry for the useless and bad edit. Too many hours of coding, I think my brain was about to turn off last night... Thanks for your answer anyway – Jérôme MEVEL Sep 18 '16 at 16:31
  • I know you said this, but I didn't understand what you meant. Note that "UI" refers to the name of the folder that contains the views. Mine was called "Views" so adding "UI" to my publishOptions didn't work :-p – Lee Oades Oct 20 '16 at 09:41