title: Publish ASP.NET CORE web app with AngularJS to IIS
body: <p>We are writing a new asp.net core web app (with the full .net framework), using angularjs ver. 1.5.8.<br>
  We are just starting out with the app, so it's very simple atm, with only just one page that contains a table with student data.<br>
  Now, when I run the application using IIS Express, the application works fine,  the data is displayed and there are no errors in the browser's console.<br>
  But when I publish the app to my local IIS, it doesn't work. The angular view is empty, so just the _layout is displayed.<br>
  I've tried the steps described in <a href="https://docs.asp.net/en/latest/publishing/iis.html" rel="nofollow noreferrer">https://docs.asp.net/en/latest/publishing/iis.html</a>, but like I said, it doesn't work.<br>
  Here's the code I'm using:  </p>
  
  <p><strong>Program.Main()</strong>:  </p>
  
  <pre><code>public static void Main(string[] args)
          {
              var host = new WebHostBuilder()
                  .UseKestrel()
                  .UseContentRoot(Directory.GetCurrentDirectory())
                  .UseIISIntegration()
                  .UseStartup&lt;Startup&gt;()
                  .Build();
  
              host.Run();
          }  
  </code></pre>
  
  <p><strong>site.js (the angular stuff)</strong>:  </p>
  
  <pre><code>angular.module('digitalRural', ['ngRoute', 'ngMaterial'])
      .config(function ($routeProvider) {
          $routeProvider
              .when('/',                                                  // Students controller
              {
                  controller: 'StudentsController as students',
                  templateUrl: 'html/students/index.html'
              })
              .when('/student/edit/:studentId',
              {
                  controller: 'EditStudentController as editStudent',
                  templateUrl: 'html/students/edit.html'
              })
              .when('/student/new',
              {
                  controller: 'NewStudentController as newStudent',
                  templateUrl: 'html/students/new.html'
              })
              .when('/login/',                                            // Login controller
              {
                  controller: 'LoginController as loginCtrl',
                  templateUrl: 'html/home/welcome.html'
              })
              .otherwise({
                  redirectTo: '/'
              });
      })
      .controller('StudentsController',
          function ($http) {
              var students = this;
  
              $http.get("/api/students")
                  .then(function (response) {
                      students.items = response.data;
                  });
          })
      .controller('LoginController',
          function ($http) {
              var loginCtrl = this;
  
              $http.get("/api/login")
                  .then(function (response) {
                      loginCtrl.currentUser = response.data;
                  });
          });  
  </code></pre>
  
  <p>Here's an image of the deployed app:<br>
  <a href="https://i.stack.imgur.com/Ptk1q.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/Ptk1q.png" alt="enter image description here"></a> </p>
  
  <p>and the error in Chrome's console:  </p>
  
  <pre><code>Failed to load resource: the server responded with a status of 404 (Not Found)
  angular.js:13920 Error: [$compile:tpload] http://errors.angularjs.org/1.5.8/$compile/tpload?p0=html%2Fstudents%2Findex.html&amp;p1=404&amp;p2=Not%20Found
      at Error (native)
      at http://localhost/DigitalRural/lib/angular/angular.min.js:6:412
      at http://localhost/DigitalRural/lib/angular/angular.min.js:156:511
      at http://localhost/DigitalRural/lib/angular/angular.min.js:131:20
      at m.$eval (http://localhost/DigitalRural/lib/angular/angular.min.js:145:347)
      at m.$digest (http://localhost/DigitalRural/lib/angular/angular.min.js:142:420)
      at m.$apply (http://localhost/DigitalRural/lib/angular/angular.min.js:146:113)
      at l (http://localhost/DigitalRural/lib/angular/angular.min.js:97:322)
      at J (http://localhost/DigitalRural/lib/angular/angular.min.js:102:34)
      at XMLHttpRequest.t.onload (http://localhost/DigitalRural/lib/angular/angular.min.js:103:4)  
  </code></pre>
  
  <p>What's weird is that all works fine with IIS Express, but with IIS, I get the error message above.  </p>
  
  <p>What gives?</p>