Development time IIS support for ASP.NET Core Applications

With a recent update to Visual Studio 2017, we have added support for debugging ASP.NET Core applications against IIS. This blog post will walk you through enabling this feature and setting up your project to use this feature.

Getting Started

To get started:

  • You need to install Visual Studio 2017 (version 15.3) Preview (it will not work with any earlier version of Visual Studio)
  • You must have the ASP.NET and web development workload OR the .NET Core cross-platform development workload installed

Enable IIS

Before you can enable Development time IIS support in Visual Studio, you will need to enable IIS. You can do this by selecting the Internet Information Services checkbox in the Turn Windows features on or off dialog.

If your IIS installation requires a reboot, make sure to complete it before proceeding to the next step.

Development time IIS support

Once you’ve installed IIS, you can launch the Visual Studio installer to modify your existing Visual Studio installation. In the installer select the Development time IIS support component which is listed as optional component under the ASP.NET and web development workload. This will install the ASP.NET Core Module which is a native IIS module required to run ASP.NET Core applications on IIS.

Adding support to an existing project

You can now create a new launch profile to add Development time IIS support . Make sure to select IIS from the Launch dropdown in the Debug tab of Project properties of your existing ASP.NET Core application

Alternativately, you can add manually a launch profile to your launchSettings.json file.

{
    "iisSettings": {
        "windowsAuthentication": false,
        "anonymousAuthentication": true,
        "iis": {
            "applicationUrl": "http://localhost/WebApplication2",
            "sslPort": 0
        }
    },
    "profiles": {
        "IIS": {
            "commandName": "IIS",
            "launchBrowser": "true",
            "launchUrl": "http://localhost/WebApplication2",
            "environmentVariables": {
                "ASPNETCORE_ENVIRONMENT": "Development"
            }
        }
    }
}

Congratulations! At this point, your project is all set up for development time IIS support. You may be prompted to restart Visual Studio if weren’t running as an administrator.

Conclusion

We look forward to you trying out this feature and let us know how it works for you. You can do that below, or via twitter @AndrewBrianHall and @sshirhatti.