ttmind

Main Navigation

ttmind
  • jim-jams
  • Tech
  • Positive
Login

Login

Facebook Google

OR

Remember me Forgot password?

Don't have account? Signup here.

Sort by Categorys

.Net

PHP

Java

JavaScript

Database

Server

Client Side

Tools

Artificial Intelligence

Cloud

Hybrid Development

Event

Smart City

Education

Security

Scrum

Digital Marketing

APP Development

Business

Internet

Simulation

Art

Network

Microservices

Architecture

Technology

Leadership

    Top Articles

  • How Does Social Media Bring People Together?
    TTMind Author
  • How to read appSettings JSON from Class Library in ASP.NET Core
    Anil Shrestha
  • Printing Support In Asp.Net Core
    TTMind Author
  • HOW TO EXTRACT TEXT FROM IMAGE USING JAVASCRIPT (OCR with Tesseract.js)?
    Prakash Pokhrel
  • Images Upload REST API using ASP.NET Core
    Prakash Pokhrel
  • Related Topic

  • How to read appSettings JSON from Class Library in ASP.NET Core
  • Printing Support In Asp.Net Core
  • Images Upload REST API using ASP.NET Core
  • How to use IActionFilter, IAsyncActionFilter in ASP.NET Core MVC?
  • ASP.NET CORE - Blazor CRUD operation using ADO.NET
  • Tech
  • About Us
  • Contact Us
  • TechHelp
  • PositiveHelp
  • Jim-Jams Help
  • Terms & Conditions

© Copyright ttmind.com

Main Content

What is launchsetting.json in ASP.NET CORE?

.Net .Net Core about 8 years ago || 4/25/2018 || 1.4 K View

  • Hide

This json record holds extend particular settings related with each troubleshoot profile, Visual Studio is arranged to use to dispatch the application, including any condition factors that ought to be utilized. You can characterize structure for your venture for accumulation and troubleshooting for particular profiles. This document is set in Properties envelope.

In above passage, I specified about visual studio extend troubleshoot profiles and condition factors. Before we advance, it's essential to comprehend about these 2.

Environment Variables

As mentioned on Wikipedia “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 various environment variables present in ASP.NET 5 which can be set that will affect various parts of the runtime. You can find the complete list here. But for this post, we are interested in ASPNET_ENV variable. This variable actually defines the environment the application is currently running in. There are 3 values are used by convention:  Development, Staging, and Production. We are also allowed to set any value which we want.

if you see Startup.cs class code, you will see these values are used.

The above code is checking if running environment is development or not env.IsDevelopment()

Visual Studio Project Debug Profiles

Visual studio underpins the numerous troubleshoot profiles, related with IIS express and summons characterized in project.json.

ASP.NET 5 ships with support for 3 unique 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 2015 is IIS/IIS express. Therefore, even for empty website, “Microsoft.AspNet.Server.IIS” dependency is defined in project.json. What's more, in the event of site, there can be 3 distinct profiles. You can oversee settings for each profile in troubleshoot tab of venture property menu.

As per the screenshot, you can also define environment variables; launch URL, specific runtime to use for each profile. Please remember the value for ASP_ENV (Hosting:Enviroment) is case insensitive. But when you try to define the same key again for a different value, you will get duplicate key error.

So when you modify the default settings for your project, changes are persisted in launchSettings.json. Now let’s take a look at launchsetting.json code.

The initial segment characterizes the IIS settings as IIS is the default web have decision. Also, there are 3 profiles "IIS Express", "web" and "kestrel" in profile segment. What's more, for each profile, condition variable, runtime rendition to utilize and its order name is likewise characterized. As said before, charge names are characterized in project.json document. So when you dispatch your application utilizing any of the choice, setting characterized in launchsetting will be utilized for your web application.

We can run the web command from a command prompt using dnx like dnx web. This will host your application and the settings will be picked up from commands.

Startup Conventions

As said before that ASPNET_ENV can have 3 esteems tradition: Development, Staging, and Production. Furthermore, with ASP.NET 5, the Startup class is utilized for bootstraping the application and stacking your whole setup. What's more, there is additionally a tradition exists for Startup's and ASPNET_ENV esteems. You are permitted to make Startup class with condition variable name Startup {EnvironmentName} (for instance StartupDevelopment). So you can have StartupDevelopment, StartupStaging and StartupProduction. Also, in view of the ASPNET_ENV condition variable esteem, that Startup class is utilized. Along these lines, it gives you the adaptability to design Startup settings for various conditions.

  • 3
  • 0
  • 0
    • Facebook
    • Twitter
    • Google +
    • LinkedIn

About author

Charles Lytton

Charles Lytton

Architect, Developer, SystemsEngineer, WebDesigner, ProjectLead, Consultant, TrainerMentot

C# Lover

Reset Your Password
Enter your email address that you used to register. We'll send you an email with your username and a link to reset your password.

Quick Survey