当前位置: 首页>>代码示例>>C#>>正文


C# ConfigurationBuilder.AddApplicationInsightsSettings方法代码示例

本文整理汇总了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
        }
开发者ID:ChrisDobby,项目名称:allReady,代码行数:29,代码来源:Startup.cs

示例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();
        }
开发者ID:Microsoft,项目名称:mattercenter,代码行数:26,代码来源:Startup.cs

示例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");
        }
开发者ID:Charmatzis,项目名称:IT4GOV,代码行数:31,代码来源:Startup.cs

示例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());
        }
开发者ID:jango2015,项目名称:ApplicationInsights-aspnet5,代码行数:9,代码来源:Startup.cs

示例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());
        }
开发者ID:RehanSaeed,项目名称:ApplicationInsights-aspnetcore,代码行数:11,代码来源:Startup.cs

示例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();
 }
开发者ID:ebt-techtalk,项目名称:asp.net,代码行数:10,代码来源:Startup.cs

示例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();

        }
开发者ID:PaulieS,项目名称:NetCoreECommerceTemplate,代码行数:13,代码来源:Startup.cs

示例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);
            }
        }
开发者ID:ealsur,项目名称:mvpstream,代码行数:13,代码来源:Startup.cs

示例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");
        }
开发者ID:gerry123,项目名称:g42,代码行数:13,代码来源:Startup.cs

示例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();
        }
开发者ID:daniel-kun,项目名称:guess-what,代码行数:14,代码来源:Startup.cs

示例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");
        }
开发者ID:gobetti,项目名称:ContactsBackEnd,代码行数:14,代码来源:Startup.cs

示例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();
        }
开发者ID:saxx,项目名称:Haufwerk,代码行数:14,代码来源:Startup.cs

示例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();
        }
开发者ID:weibin268,项目名称:Zhuang.UPMS,代码行数:15,代码来源:Startup.cs

示例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");
        }
开发者ID:gitter-badger,项目名称:DnxTestWebApp,代码行数:15,代码来源:Startup.cs

示例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();
		}
开发者ID:MarcinSzyszka,项目名称:MobileSecondHand,代码行数:17,代码来源:Startup.cs


注:本文中的Microsoft.Extensions.Configuration.ConfigurationBuilder.AddApplicationInsightsSettings方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。