public HttpResponseMessage UpdateSettings(AppInsightsSettings appInsightSettings) { try { var settings = new Dictionary <string, string> { { "AppInsights.Enabled", appInsightSettings.Enabled.ToString() }, { "AppInsights.InstrumentationKey", appInsightSettings.InstrumentationKey } }; HostController.Instance.Update(settings); // Update the configuration files AppInsightsConfig.ModifyLog4NetConfigFile(!appInsightSettings.Enabled); AppInsightsConfig.ModifyAppInsightsConfigFile(!appInsightSettings.Enabled); AppInsightsConfig.ModifyAppInsightsJsFile(!appInsightSettings.Enabled); AppInsightsConfig.ModifyWebConfigFile(!appInsightSettings.Enabled); // Increment the CRM version to avoid appinsights.js caching HostController.Instance.IncrementCrmVersion(true); return(Request.CreateResponse(HttpStatusCode.OK)); } catch (Exception ex) { Logger.Error(ex); return(Request.CreateErrorResponse(HttpStatusCode.InternalServerError, ex)); } }
public SuggestionsController(AppInsightsConfig appInsightsConfig, SearchConfig searchConfig, TelemetryClient telemetryClient) { _appInsightsConfig = appInsightsConfig; _searchConfig = searchConfig; _telemetryClient = telemetryClient; _telemetryClient.InstrumentationKey = _appInsightsConfig.InstrumentationKey; _searchClient = new SearchClient(_searchConfig, _telemetryClient); }
public IndexerController(AppInsightsConfig appInsightsConfig, SearchConfig searchConfig, BlobStorageConfig storageConfig, TelemetryClient telemetryClient) { _appInsightsConfig = appInsightsConfig; _searchConfig = searchConfig; _storageConfig = storageConfig; _telemetryClient = telemetryClient; _telemetryClient.InstrumentationKey = _appInsightsConfig.InstrumentationKey; _searchClient = new SearchClient(_searchConfig, _telemetryClient); }
protected void Application_Start() { AppInsightsConfig.Register(); AreaRegistration.RegisterAllAreas(); GlobalConfiguration.Configure(WebApiConfig.Register); FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters); RouteConfig.RegisterRoutes(RouteTable.Routes); BundleConfig.RegisterBundles(BundleTable.Bundles); }
protected void Application_Start() { AreaRegistration.RegisterAllAreas(); GlobalConfiguration.Configure(WebApiConfig.Register); FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters); RouteConfig.RegisterRoutes(RouteTable.Routes); BundleConfig.RegisterBundles(BundleTable.Bundles); DatabaseConfig.Configuration(); Database.SetInitializer <QuizDbContext>(new DropCreateDatabaseIfModelChanges <QuizDbContext>()); AppInsightsConfig.Configure(); }
// This method gets called by the runtime. Use this method to add services to the container. public void ConfigureServices(IServiceCollection services) { services.Configure <CookiePolicyOptions>(options => { // This lambda determines whether user consent for non-essential cookies is needed for a given request. options.CheckConsentNeeded = context => true; options.MinimumSameSitePolicy = SameSiteMode.None; }); var appInsightsConfig = new AppInsightsConfig { InstrumentationKey = Configuration["APPINSIGHTS_INSTRUMENTATIONKEY"] }; services.AddSingleton(appInsightsConfig); services.AddApplicationInsightsTelemetry(appInsightsConfig.InstrumentationKey); var apiConfig = new ApiConfig { BaseUrl = Configuration["ApiUrl"] }; services.AddSingleton(apiConfig); var orgConfig = new OrganizationConfig { Logo = Configuration["OrganizationLogo"], Name = Configuration["OrganizationName"], Url = Configuration["OrganizationWebSiteUrl"], }; services.AddSingleton(orgConfig); var appConfig = new AppConfig { ApiConfig = apiConfig, AppInsights = appInsightsConfig, Organization = orgConfig, Customizable = Configuration["Customizable"].Equals("true", StringComparison.InvariantCultureIgnoreCase) }; services.AddSingleton(appConfig); services.AddSingleton <IFileProvider>(new PhysicalFileProvider(Path.Combine(Directory.GetCurrentDirectory(), "wwwroot"))); services.AddMvc().SetCompatibilityVersion(CompatibilityVersion.Version_2_2); }
// This method gets called by the runtime. Use this method to add services to the container. public void ConfigureServices(IServiceCollection services) { services.AddCors(options => { options.AddPolicy(AllowCorsPolicy, builder => { builder.AllowAnyOrigin() .AllowAnyMethod() .AllowAnyHeader(); }); }); var appInsightsConfig = new AppInsightsConfig { InstrumentationKey = Configuration["APPINSIGHTS_INSTRUMENTATIONKEY"] }; services.AddSingleton(appInsightsConfig); services.AddApplicationInsightsTelemetry(appInsightsConfig.InstrumentationKey); services.AddMvc().SetCompatibilityVersion(CompatibilityVersion.Version_2_2); var searchConfig = new SearchConfig { ServiceName = Configuration["SearchServiceName"], Key = Configuration["SearchServiceKey"], ApiVersion = Configuration["SearchServiceApiVersion"], IndexName = Configuration["SearchIndexName"] }; services.AddSingleton(searchConfig); var storageConfig = new BlobStorageConfig { AccountName = Configuration["StorageAccountName"], Key = Configuration["StorageAccountKey"], ContainerName = Configuration["StorageAccountContainerName"], //FacetsFilteringContainerName = Configuration["FacetsFilteringContainerName"] UploadContainerName = Configuration["UploadStorageContainerName"] }; services.AddSingleton(storageConfig); }
// This method gets called by the runtime. Use this method to add services to the container. public void ConfigureServices(IServiceCollection services) { services.AddMvc(x => x.EnableEndpointRouting = false); services.Configure <CookiePolicyOptions>(options => { // This lambda determines whether user consent for non-essential cookies is needed for a given request. options.CheckConsentNeeded = context => true; options.MinimumSameSitePolicy = SameSiteMode.None; }); var appInsightsConfig = new AppInsightsConfig { InstrumentationKey = Configuration["APPINSIGHTS_INSTRUMENTATIONKEY"] }; services.AddSingleton(appInsightsConfig); services.AddApplicationInsightsTelemetry(appInsightsConfig.InstrumentationKey); var apiConfig = new ApiConfig { BaseUrl = Configuration["ApiUrl"], MrcApiUrl = Configuration["MrcApiUrl"], DocEntitiesApiUrl = Configuration["DocEntitiesApiUrl"], WidgetApiUrl = Configuration["WidgetApiUrl"] }; services.AddSingleton(apiConfig); var orgConfig = new OrganizationConfig { Logo = Configuration["OrganizationLogo"], Name = Configuration["OrganizationName"], Url = Configuration["OrganizationWebSiteUrl"], }; services.AddSingleton(orgConfig); var authorizationConfig = new AuthorizationConfig { AuthorityUri = Configuration["AuthorityUri"], ResourceUrl = Configuration["ResourceUrl"], RedirectUrl = Configuration["RedirectUrl"], PowerBIApiUrl = Configuration["PowerBIApiUrl"], ApplicationId = Configuration["ApplicationId"], LoggingRequestUrl = Configuration["LoggingRequestUrl"] }; #if DEBUG authorizationConfig.RedirectUrl = Configuration["RedirectUrlLocalhost"]; #endif services.AddSingleton(authorizationConfig); var appConfig = new AppConfig { ApiConfig = apiConfig, AppInsights = appInsightsConfig, Organization = orgConfig, Authorization = authorizationConfig, Customizable = Configuration["Customizable"].Equals("true", StringComparison.InvariantCultureIgnoreCase) }; services.AddSingleton(appConfig); services.AddSingleton <IFileProvider>(new PhysicalFileProvider(Path.Combine(Directory.GetCurrentDirectory(), "wwwroot"))); services.AddMvc().SetCompatibilityVersion(CompatibilityVersion.Version_2_2); }