本文整理汇总了C#中Microsoft.Extensions.Configuration.ConfigurationBuilder.AddApplicationInsightsSettings方法的典型用法代码示例。如果您正苦于以下问题:C# ConfigurationBuilder.AddApplicationInsightsSettings方法的具体用法?C# ConfigurationBuilder.AddApplicationInsightsSettings怎么用?C# ConfigurationBuilder.AddApplicationInsightsSettings使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Microsoft.Extensions.Configuration.ConfigurationBuilder
的用法示例。
在下文中一共展示了ConfigurationBuilder.AddApplicationInsightsSettings方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Startup
public Startup(IHostingEnvironment env)
{
// Setup configuration sources.
var builder = new ConfigurationBuilder()
.SetBasePath(env.ContentRootPath)
.AddJsonFile("version.json")
.AddJsonFile("config.json")
.AddJsonFile($"config.{env.EnvironmentName}.json", optional: true)
.AddEnvironmentVariables();
if (env.IsDevelopment())
{
// 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();
// This will push telemetry data through Application Insights pipeline faster, allowing you to view results immediately.
builder.AddApplicationInsightsSettings(developerMode: true);
}
else if (env.IsStaging() || env.IsProduction())
{
// This will push telemetry data through Application Insights pipeline faster, allowing you to view results immediately.
builder.AddApplicationInsightsSettings(developerMode: false);
}
Configuration = builder.Build();
Configuration["version"] = new ApplicationEnvironment().ApplicationVersion; // version in project.json
}
示例2: Startup
public Startup(IHostingEnvironment env, ILoggerFactory logger)
{
this.HostingEnvironment = env;
this.LoggerFactory = logger;
string projectName = env.ApplicationName;
int projLength = projectName.Length;
string path = env.ContentRootPath;
int index = path.IndexOf(projectName);
int last = index + projLength;
string basePath = path.Remove(last);
var builder = new ConfigurationBuilder()
.SetBasePath(basePath)
.AddJsonFile("appsettings.json", optional: true, reloadOnChange: true)
.AddEnvironmentVariables();
if (HostingEnvironment.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)
{
// Set up configuration sources.
var builder = new ConfigurationBuilder()
.AddJsonFile("appsettings.json");
#if DEBUG
URLS.Api_url = "http://localhost:58517/";
URLS.Html_url = "http://localhost:7079/oauth.html";
URLS.Idt_url = "http://localhost:58058/";
URLS.Mvc_url = "http://localhost:7079/signin-oidc";
#endif
#if RELEASE
URLS.Api_url = "http://it4govwebapi.azurewebsites.net/";
URLS.Html_url = "http://it4govwebapp.azurewebsites.net/oauth.html";
URLS.Idt_url = "http://it4govidentityserver.azurewebsites.net";
URLS.Mvc_url = "http://it4govwebapp.azurewebsites.net/signin-oidc";
#endif
// This will push telemetry data through Application Insights pipeline faster, allowing you to view results immediately.
builder.AddApplicationInsightsSettings(developerMode: true);
builder.AddEnvironmentVariables();
Configuration = builder.Build().ReloadOnChanged("appsettings.json");
}
示例4: ConfigureServices
// For more information on how to configure your application, visit http://go.microsoft.com/fwlink/?LinkID=398940
public void ConfigureServices(IServiceCollection services)
{
services.AddInstance<ITelemetryChannel>(new BackTelemetryChannel());
var builder = new ConfigurationBuilder();
builder.AddApplicationInsightsSettings(instrumentationKey: "Foo");
services.AddApplicationInsightsTelemetry(builder.Build());
}
示例5: ConfigureServices
// For more information on how to configure your application, visit http://go.microsoft.com/fwlink/?LinkID=398940
public void ConfigureServices(IServiceCollection services)
{
services.AddSingleton<IHttpContextAccessor, HttpContextAccessor>();
services.AddSingleton<IActionContextAccessor, ActionContextAccessor>();
services.AddSingleton<ITelemetryChannel>(new BackTelemetryChannel());
var builder = new ConfigurationBuilder();
builder.AddApplicationInsightsSettings(instrumentationKey: "Foo");
services.AddApplicationInsightsTelemetry(builder.Build());
}
示例6: Startup
public Startup(IHostingEnvironment env)
{
var builder = new ConfigurationBuilder()
.SetBasePath(env.ContentRootPath)
.AddJsonFile("appsettings.json", optional: true, reloadOnChange: true)
.AddJsonFile($"appsettings.{env.EnvironmentName}.json", optional: true)
.AddEnvironmentVariables();
builder.AddApplicationInsightsSettings(developerMode: env.IsDevelopment());
Configuration = builder.Build();
}
示例7: Startup
public Startup(IHostingEnvironment env)
{
// Set up configuration sources.
var builder = new ConfigurationBuilder();
// This will push telemetry data through Application Insights pipeline faster, allowing you to view results immediately.
builder.AddApplicationInsightsSettings(developerMode: true);
builder.AddEnvironmentVariables();
Configuration = builder.Build();
}
示例8: Startup
public Startup(IHostingEnvironment env)
{
var builder = new ConfigurationBuilder()
.SetBasePath(env.ContentRootPath)
.AddJsonFile("appsettings.json")
.AddEnvironmentVariables();
Configuration = builder.Build();
if (env.IsDevelopment())
{
builder.AddApplicationInsightsSettings(developerMode: true);
}
}
示例9: Startup
public Startup(IHostingEnvironment env)
{
var builder = new ConfigurationBuilder()
.AddJsonFile("appsettings.json");
if (env.IsEnvironment("Development"))
{
builder.AddApplicationInsightsSettings(developerMode: true);
}
builder.AddEnvironmentVariables();
Configuration = builder.Build().ReloadOnChanged("appsettings.json");
}
示例10: Startup
public Startup(IHostingEnvironment env, IApplicationEnvironment appEnv)
{
var builder = new ConfigurationBuilder()
.AddJsonFile("appsettings.json")
.AddJsonFile($"appsettings.{env.EnvironmentName}.json", optional: true)
.AddEnvironmentVariables();
builder.AddUserSecrets();
if (env.IsEnvironment("Development"))
{
builder.AddApplicationInsightsSettings(developerMode: true);
}
Configuration = builder.Build();
}
示例11: Startup
public Startup(IHostingEnvironment env)
{
// Set up configuration sources.
var builder = new ConfigurationBuilder().AddJsonFile("appsettings.json");
if (env.IsEnvironment("Development"))
{
// This will push telemetry data through Application Insights pipeline faster, allowing you to view results immediately.
builder.AddApplicationInsightsSettings(developerMode: true);
}
builder.AddEnvironmentVariables();
Configuration = builder.Build().ReloadOnChanged("appsettings.json");
}
示例12: Startup
public Startup(IHostingEnvironment env)
{
_isDevEnvironment = env.IsDevelopment();
var builder = new ConfigurationBuilder()
.AddJsonFile("Haufwerk.json")
.AddEnvironmentVariables("Haufwerk:");
if (env.IsDevelopment())
{
// This will push telemetry data through Application Insights pipeline faster, allowing you to view results immediately.
builder.AddApplicationInsightsSettings(true);
}
Configuration = builder.Build();
}
示例13: Startup
public Startup(IHostingEnvironment env)
{
var builder = new ConfigurationBuilder()
.SetBasePath(env.ContentRootPath)
.AddJsonFile("appsettings.json", optional: true, reloadOnChange: true)
.AddJsonFile($"appsettings.{env.EnvironmentName}.json", optional: true)
.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();
}
示例14: Startup
public Startup(IHostingEnvironment env)
{
var builder = new ConfigurationBuilder()
.AddJsonFile("appsettings.json")
.AddJsonFile($"appsettings.{env.EnvironmentName}.json");
if (env.IsDevelopment())
builder.AddApplicationInsightsSettings(true);
builder.AddEnvironmentVariables();
Configuration = builder
.Build()
.ReloadOnChanged("appsettings.json")
.ReloadOnChanged($"appsettings.{env.EnvironmentName}.json");
}
示例15: Startup
public Startup(IHostingEnvironment env) {
var builder = new ConfigurationBuilder()
.SetBasePath(env.ContentRootPath)
.AddJsonFile("appsettings.json", optional: true, reloadOnChange: true)
.AddJsonFile($"appsettings.{env.EnvironmentName}.json", optional: true);
if (env.IsDevelopment()) {
// For more details on using the user secret store see http://go.microsoft.com/fwlink/?LinkID=532709
builder.AddUserSecrets();
// This will push telemetry data through Application Insights pipeline faster, allowing you to view results immediately.
builder.AddApplicationInsightsSettings(developerMode: true);
}
builder.AddEnvironmentVariables();
Configuration = builder.Build();
}