本文整理汇总了C#中Microsoft.Framework.Configuration.ConfigurationBuilder.AddApplicationInsightsSettings方法的典型用法代码示例。如果您正苦于以下问题:C# ConfigurationBuilder.AddApplicationInsightsSettings方法的具体用法?C# ConfigurationBuilder.AddApplicationInsightsSettings怎么用?C# ConfigurationBuilder.AddApplicationInsightsSettings使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Microsoft.Framework.Configuration.ConfigurationBuilder
的用法示例。
在下文中一共展示了ConfigurationBuilder.AddApplicationInsightsSettings方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Startup
public Startup(IHostingEnvironment env, IApplicationEnvironment appEnvironment)
{
var configBuilder = new ConfigurationBuilder(appEnvironment.ApplicationBasePath);
configBuilder.AddJsonFile("config.json");
configBuilder.AddEnvironmentVariables();
if (env.IsEnvironment("Development"))
{
configBuilder.AddApplicationInsightsSettings(developerMode: true);
}
this.config = configBuilder.Build();
}
示例2: Startup
public Startup(IHostingEnvironment env, IApplicationEnvironment appEnv)
{
// Setup configuration sources.
var builder = new ConfigurationBuilder(appEnv.ApplicationBasePath)
.AddJsonFile("config.json")
.AddEnvironmentVariables();
if (env.IsDevelopment())
{
// This will push telemetry data through Application Insights pipeline faster, allowing you to view results immediately.
builder.AddApplicationInsightsSettings(developerMode: true);
}
Configuration = builder.Build();
}
示例3: Startup
public Startup(IHostingEnvironment env, IApplicationEnvironment appEnv)
{
var builder = new ConfigurationBuilder(appEnv.ApplicationBasePath)
.AddJsonFile("config.json")
.AddJsonFile($"config.{env.EnvironmentName}.json", true)
.AddUserSecrets(); // workaround til I know how to set up environment variables in IIS Express
if (env.IsDevelopment())
{
//builder.AddUserSecrets();
builder.AddApplicationInsightsSettings(true);
}
builder.AddEnvironmentVariables();
Configuration = builder.Build();
}
示例4: Startup
public Startup(IHostingEnvironment env)
{
// Setup configuration sources.
var builder = new ConfigurationBuilder(env.MapPath(@"..\"))
.AddJsonFile("config.json", optional: true)
.AddJsonFile($"config.{env.EnvironmentName}.json", optional: true);
if (env.IsEnvironment("Development"))
{
// This reads the configuration keys from the secret store.
// For more details on using the user secret store see http://go.microsoft.com/fwlink/?LinkID=532709
builder.AddUserSecrets();
builder.AddApplicationInsightsSettings(developerMode: true);
}
builder.AddEnvironmentVariables();
Configuration = builder.Build();
}
示例5: Startup
public Startup(IHostingEnvironment env, IApplicationEnvironment appEnv)
{
// Setup configuration sources.
var builder = new ConfigurationBuilder(appEnv.ApplicationBasePath)
.AddJsonFile("config.json", true)
.AddJsonFile($"config.{env.EnvironmentName}.json", true);
builder.AddUserSecrets();
if (env.IsDevelopment())
{
// put ApplicationInsights in developer mode
builder.AddApplicationInsightsSettings(true);
}
builder.AddEnvironmentVariables();
Configuration = builder.Build();
}
示例6: Startup
public Startup(IHostingEnvironment env, IApplicationEnvironment appEnv)
{
// Setup configuration sources.
var builder = new ConfigurationBuilder(appEnv.ApplicationBasePath)
.AddJsonFile("config.json")
.AddEnvironmentVariables()
.AddJsonFile($"config.{env.EnvironmentName}.json", optional: true);
if (env.IsDevelopment())
{
// This will push telemetry data through Application Insights pipeline faster, allowing you to view results immediately.
builder.AddApplicationInsightsSettings(developerMode: true);
// For more details on using the user secret store see http://go.microsoft.com/fwlink/?LinkID=532709
builder.AddUserSecrets();
}
builder.AddEnvironmentVariables();
Configuration = builder.Build();
}
示例7: ConfigureConfiguration
/// <summary>
/// Creates and configures the application configuration, where key value pair settings are stored. See
/// http://docs.asp.net/en/latest/fundamentals/configuration.html
/// http://weblog.west-wind.com/posts/2015/Jun/03/Strongly-typed-AppSettings-Configuration-in-ASPNET-5
/// </summary>
/// <param name="applicationEnvironment">The location the application is running in</param>
/// <param name="hostingEnvironment">The environment the application is running under. This can be Development,
/// Staging or Production by default.</param>
/// <returns>A collection of key value pair settings.</returns>
private static IConfiguration ConfigureConfiguration(
IApplicationEnvironment applicationEnvironment,
IHostingEnvironment hostingEnvironment)
{
IConfigurationBuilder configurationBuilder = new ConfigurationBuilder()
.SetBasePath(applicationEnvironment.ApplicationBasePath);
// Add configuration from the config.json file.
configurationBuilder.AddJsonFile("config.json");
// Add configuration from an optional config.development.json, config.staging.json or
// config.production.json file, depending on the environment. These settings override the ones in the
// config.json file.
configurationBuilder.AddJsonFile($"config.{hostingEnvironment.EnvironmentName}.json", optional: true);
// This reads the configuration keys from the secret store. This allows you to store connection strings
// and other sensitive settings, so you don't have to check them into your source control provider. See
// http://go.microsoft.com/fwlink/?LinkID=532709 and
// http://docs.asp.net/en/latest/security/app-secrets.html
configurationBuilder.AddUserSecrets();
// Add configuration specific to the Development, Staging or Production environments. This config can
// be stored on the machine being deployed to or if you are using Azure, in the cloud. These settings
// override the ones in all of the above config files.
// Note: To set environment variables for debugging navigate to:
// Project Properties -> Debug Tab -> Environment Variables
// Note: To get environment variables for the machine use the following command in PowerShell:
// $env:[VARIABLE_NAME]
// Note: To set environment variables for the machine use the following command in PowerShell:
// $env:[VARIABLE_NAME]="[VARIABLE_VALUE]"
// Note: Environment variables use a colon separator e.g. You can override the site title by creating a
// variable named AppSettings:SiteTitle. See
// http://docs.asp.net/en/latest/security/app-secrets.html
configurationBuilder.AddEnvironmentVariables();
// $Start-ApplicationInsights$
// Push telemetry data through the Azure Application Insights pipeline faster in the development and
// staging environments, allowing you to view results immediately.
configurationBuilder.AddApplicationInsightsSettings(developerMode: !hostingEnvironment.IsProduction());
// $End-ApplicationInsights$
return configurationBuilder.Build();
}