How to configure an MVC6 app to work on IIS?

So I'm building an MVC6 app in Visual Studio 2015 and have managed to figure most stuff out, however, I haven't yet worked out deployment.

In MVC4 (what I was using before), our process* was publish to a folder, then setup the website in IIS (Right-Click on Sites -> Add Website).

  • Actually, our process is set it up in IIS and TeamCity, but not for test apps like this :).

I followed this process and obviously it's trivial to setup the IIS website and publish to the correct folder...but that does not actually work for me.

We're running IIS 8 on Windows Server 2012 and we've installed the .Net 4.6 runtime on the server.

asked May 7, 2015 in Asp.Net by rajesh
0 votes

1 Answer

0 votes

The following steps have worked for me and should help you host your project on IIS.

Using Visual Studio 2015 Preview as your IDE,

  1. Create an ASP .NET 5 Starter App.
  2. Check that it is working outside of IIS.
  3. Once complete, publish the application. In this example, I have selected the location C:\PublishWebApp.

    3.1. When publishing your application, make sure that you have:

    • Disabled precompilation
    • Selected amd64

      (See image below)

Publish Settings Screenshot

  1. Upon a successful publish, go to C:\PublishWebApp.You should see the folders approot and wwwroot inside.
  2. Now open the IIS Manager (I am assuming you have the ASP .NET 4.5 feature enabled)
  3. Create a new website.

    6.1 : Select the wwwrooot folder as the website's physical path. In this example, it is C:\PublishWebApp\wwwroot.

  4. Check the website to see that it is working. If you encounter any errors, please post them here.

If the precompile option is ticked in the Publish Web Settings window pictured above, then you must

  1. Go to the wwwroot folder of your published web application. In this example, it is C:\PublishWebApp\wwwroot.
  2. Locate web.config.
  3. Inside the folder of your published application, there is an packages folder inside of the approotfolder which should contain a folder named after your application, with a folder for the version underneath. Inside that folder should be a folder named root. In web.config, set the value for the key kre-app-base to the root folder. For reference, see the line of code below. In this example, the application name is WebApplication10.

answered May 7, 2015 by rajesh