The conversion syntax is web.configoriented to the XML data format. New configurations consist of some JSON files, and it is very easy to implement creation scripts.
First of all, ASP.NET support allows you to set the target environment using an environment variable ASPNET_ENVor by installing Hosting:Environmentto a launchSettings.jsonfile (see Propertiesyour project folder ). The file launchSettings.jsoncan be changed in Visual Studio in the project properties. First you need to select "Profile"

and make a setting for each profile. Alternatively, you can simply edit the file Properties\launchSettings.jsonmanually.
, hosting.json, . , , , , server.urls hosting.json hosting.Development.json .
appsettings.json, Startup Startup.cs. :
public class Startup
{
public static IConfigurationRoot Configuration { get; set; }
public Startup(IHostingEnvironment env)
{
var builder = new ConfigurationBuilder()
.AddJsonFile("appsettings.json")
.AddJsonFile($"appsettings.{env.EnvironmentName}.json", true)
.AddEnvironmentVariables();
Configuration = builder.Build();
}
public void ConfigureServices(IServiceCollection services)
{
services.AddMvc()
.AddJsonOptions(options => {
options.SerializerSettings.ContractResolver =
new CamelCasePropertyNamesContractResolver();
});
services.AddEntityFramework()
.AddSqlServer()
.AddDbContext<MyContext>(options => {
options.UseSqlServer(Configuration["Data:ConnectionString"]);
})
.AddDbContext<SM9Context>(options => {
options.UseSqlServer(Configuration["Data:SM9ConnectionString"]);
});
}
}
Configuration, ConfigureServices MyContext SM9Context. , appsettings.json appsettings.Development.json, ( Data:ConnectionString Data:SM9ConnectionString):
{
"Data": {
"ConnectionString": "Server=..."
}
}
ASP.NET appsettings.json appsettings.Development.json, .
, ASP.NET 5.