If you want to look at the previous articles of this series, please visit the links given below.
Now, before starting the program, we will first open the Visual Studio 2017 and create a new Project with Project Type called ASP.NET Core Web Application (.Net Core) and type the project name and click on Ok Button. Then Select Empty Project type and click on OK button.

Now, a sample blank application project has been added. Now we need to go Nuget Package Manager for installing related packages for this configuration work under Tools à Nuget Package Manager à Manage Nuget Package Manager for Solution. Now in the nuget package manager, type the below mentioned Package manager name and click on Ok.

What is launchsetting.json?
lauchSetting.json file basically contains all the project specific settings associated with each debug profile in which Visual Studio is configured for launching the application. It also includes any environment variables that should be used. We can define framework for our project for compilation and debugging for specific profiles. This file is placed in Properties folder.
Environment Variables
If I take the reference from Wikipedia, then it says “Environment variables are a set of dynamic named values that can affect the way running processes will behave on a computer. They are part of the environment in which a process runs.” So similarly, there are different types of environment variables present in ASP.NET 5 which can be set that will affect various parts of the runtime. But in this article, I am only interested about ASPNET_ENV variable. This variable actually defines the environment the application is currently running in. There are 3 types of values that are used by convention: Development, Staging, and Production. We are also allowed to set any value which we want.
Visual Studio Project Debug Profiles
Visual Studio 2017 supports multiple debug profiles, associated with IIS express and commands defined in project.json.
ASP.NET 5 ships with support for 3 different servers,
- Microsoft.AspNet.Server.IIS
- Microsoft.AspNet.Server.WebListener (WebListener)
- Microsoft.AspNet.Server.Kestrel (Kestrel)
And the default web host for ASP.NET application created using Visual Studio 2017 is IIS/IIS express. Therefore, even for empty websites, “Microsoft.AspNet.Server.IIS” dependency is defined in project.json. And in the case of web site, there can be three different profiles. You can manage settings for each profile in debug tab of project property menu. For accessing those profiles, just open the properties window of the project files.

As per the screenshot, you can also define environment variables, launch URL, specific runtimes to use for each profile. We also need to remember the value for ASPNET_ENV (or Hosting:Environment) is case insensitive. But when you try to define the same key again for a different value, you will get a duplicate key error.



Dhanik SahniPosted May 17, 2017, 2:00 AM
Thanks. It helped me in resolving one problem.
Thiruppathi RPosted May 13, 2017, 12:32 AM
Nice article.Thanks for sharing..