public void Configure(IApplicationBuilder app, ILoggerFactory loggerFactory) { loggerFactory.AddConsole(); app.UseIISPlatformHandler(); app.UseStaticFiles(); app.UseWelcomePage(); }
public ConcreteDatabase( DbContext context, IRelationalDataStoreCreator dataStoreCreator, ILoggerFactory loggerFactory) : base(context, dataStoreCreator, loggerFactory) { }
/// <summary> /// Initializes a new instance of the <see cref="RazorViewEngine" />. /// </summary> public RazorViewEngine( IRazorPageFactoryProvider pageFactory, IRazorPageActivator pageActivator, HtmlEncoder htmlEncoder, IOptions<RazorViewEngineOptions> optionsAccessor, ILoggerFactory loggerFactory) { _options = optionsAccessor.Value; if (_options.ViewLocationFormats.Count == 0) { throw new ArgumentException( Resources.FormatViewLocationFormatsIsRequired(nameof(RazorViewEngineOptions.ViewLocationFormats)), nameof(optionsAccessor)); } if (_options.AreaViewLocationFormats.Count == 0) { throw new ArgumentException( Resources.FormatViewLocationFormatsIsRequired(nameof(RazorViewEngineOptions.AreaViewLocationFormats)), nameof(optionsAccessor)); } _pageFactory = pageFactory; _pageActivator = pageActivator; _htmlEncoder = htmlEncoder; _logger = loggerFactory.CreateLogger<RazorViewEngine>(); ViewLookupCache = new MemoryCache(new MemoryCacheOptions { CompactOnMemoryPressure = false }); }
internal DBTaskQueue( string dbConnectionString, ILoggerFactory loggerFactory) { logFactory = loggerFactory; connectionString = dbConnectionString; }
public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory, IConfigurationRoot configuration) { loggerFactory.AddConsole(configuration.GetSection("Logging")); loggerFactory.AddDebug(); // For more details on creating database during deployment see http://go.microsoft.com/fwlink/?LinkID=615859 try { using (var serviceScope = app.ApplicationServices.GetRequiredService<IServiceScopeFactory>() .CreateScope()) { using (var db = serviceScope.ServiceProvider.GetService<ApplicationDbContext>()) { db.Database.EnsureCreated(); db.Database.Migrate(); } } } catch (Exception exception) { } app.UseCors("AllowAllOrigins"); // TODO: allow collection of allowed origins per client app.UseIISPlatformHandler(); app.UseStaticFiles(); app.UseMvc(); }
public ConnectInfoForm() { XmlConfigurator.Configure(); var settings = new NinjectSettings() { LoadExtensions = false }; this.mKernel = new StandardKernel( settings, new Log4NetModule(), new ReportServerRepositoryModule()); //this.mKernel.Load<FuncModule>(); this.mLoggerFactory = this.mKernel.Get<ILoggerFactory>(); this.mFileSystem = this.mKernel.Get<IFileSystem>(); this.mLogger = this.mLoggerFactory.GetCurrentClassLogger(); InitializeComponent(); this.LoadSettings(); // Create the DebugForm and hide it if debug is False this.mDebugForm = new DebugForm(); this.mDebugForm.Show(); if (!this.mDebug) this.mDebugForm.Hide(); }
public CommonExceptionHandlerMiddleware( RequestDelegate next, ILoggerFactory loggerFactory, DiagnosticSource diagnosticSource, IOptions<ExceptionHandlerOptions> options = null ) { _next = next; if(options == null) { _options = new ExceptionHandlerOptions(); } else { _options = options.Value; } _logger = loggerFactory.CreateLogger<CommonExceptionHandlerMiddleware>(); if (_options.ExceptionHandler == null) { _options.ExceptionHandler = _next; } _clearCacheHeadersDelegate = ClearCacheHeaders; _diagnosticSource = diagnosticSource; }
public void Configure(IApplicationBuilder app, ILoggerFactory loggerFactory, IApplicationEnvironment env) { var ksi = app.ServerFeatures.Get<IKestrelServerInformation>(); ksi.NoDelay = true; loggerFactory.AddConsole(LogLevel.Error); app.UseKestrelConnectionLogging(); app.Run(async context => { Console.WriteLine("{0} {1}{2}{3}", context.Request.Method, context.Request.PathBase, context.Request.Path, context.Request.QueryString); Console.WriteLine($"Method: {context.Request.Method}"); Console.WriteLine($"PathBase: {context.Request.PathBase}"); Console.WriteLine($"Path: {context.Request.Path}"); Console.WriteLine($"QueryString: {context.Request.QueryString}"); var connectionFeature = context.Connection; Console.WriteLine($"Peer: {connectionFeature.RemoteIpAddress?.ToString()} {connectionFeature.RemotePort}"); Console.WriteLine($"Sock: {connectionFeature.LocalIpAddress?.ToString()} {connectionFeature.LocalPort}"); var content = $"Hello world!{Environment.NewLine}Received '{Args}' from command line."; context.Response.ContentLength = content.Length; context.Response.ContentType = "text/plain"; await context.Response.WriteAsync(content); }); }
// Configure is called after ConfigureServices is called. public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerfactory) { // Configure the HTTP request pipeline. // Add the console logger. loggerfactory.AddConsole(minLevel: LogLevel.Verbose); // Add the following to the request pipeline only in development environment. if (env.IsEnvironment("Development")) { app.UseBrowserLink(); app.UseErrorPage(ErrorPageOptions.ShowAll); } else { // Add Error handling middleware which catches all application specific errors and // send the request to the following path or controller action. app.UseErrorHandler("/Home/Error"); } // Add static files to the request pipeline. app.UseStaticFiles(); // Add MVC to the request pipeline. app.UseMvc(routes => { routes.MapRoute( name: "default", template: "{controller=Home}/{action=Index}/{id?}"); }); SampleData.Initialize(app.ApplicationServices); }
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline. public void Configure(IApplicationBuilder app, ILoggerFactory loggerFactory) { // The hosting environment can be found in a project's properties -> DEBUG or in launchSettings.json. if (_hostingEnvironment.IsDevelopment()) { // The exception page is only shown if the app is in development mode. app.UseDeveloperExceptionPage(); } // This middleware makes sure our app is correctly invoked by IIS. app.UseIISPlatformHandler(); // Add the MVC middleware service above first. Then use said middleware in this method. //app.UseMvc(routes => //{ // routes.MapRoute( // name: "default", // template: "{controller}/{action}/{id}", // defaults: new { controller = "Home", action = "Index" } // ); //}); app.UseMvcWithDefaultRoute(); // Always remember to add the static files middleware or the images from JavaScript or CSS // won't be served. app.UseStaticFiles(); // Whenever HTTP status codes like 404 arise, the below middleware will display them on the page. app.UseStatusCodePages(); }
public ValidationEndpointTokenProvider(IdentityServerBearerTokenAuthenticationOptions options, ILoggerFactory loggerFactory) { _logger = loggerFactory.Create(this.GetType().FullName); if (string.IsNullOrWhiteSpace(options.Authority)) { throw new Exception("Authority must be set to use validation endpoint."); } var baseAddress = options.Authority.EnsureTrailingSlash(); baseAddress += "connect/accesstokenvalidation"; _tokenValidationEndpoint = baseAddress; var handler = options.BackchannelHttpHandler ?? new WebRequestHandler(); if (options.BackchannelCertificateValidator != null) { // Set the cert validate callback var webRequestHandler = handler as WebRequestHandler; if (webRequestHandler == null) { throw new InvalidOperationException("The back channel handler must derive from WebRequestHandler in order to use a certificate validator"); } webRequestHandler.ServerCertificateValidationCallback = options.BackchannelCertificateValidator.Validate; } _client = new HttpClient(handler); _options = options; }
public XmlBlogRepository(IHostingEnvironment env, IMemoryCache memoryCache, ILoggerFactory loggerFactory) : base(env, memoryCache) { Logger = loggerFactory.CreateLogger<XmlBlogRepository>(); }
public Program() { _loggerFactory = new LoggerFactory(); var commandProvider = new CommandOutputProvider(); _loggerFactory.AddProvider(commandProvider); }
internal DBUserLogins( string dbConnectionString, ILoggerFactory loggerFactory) { logFactory = loggerFactory; connectionString = dbConnectionString; }
// Configure is called after ConfigureServices is called. public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory) { loggerFactory.MinimumLevel = LogLevel.Information; // Add the following to the request pipeline only in development environment. if (env.IsDevelopment()) { app.UseBrowserLink(); //app.UseErrorPage(ErrorPageOptions.ShowAll); } else { // Add Error handling middleware which catches all application specific errors and // sends the request to the following path or controller action. //app.UseErrorHandler("/Home/Error"); } // Add static files to the request pipeline. app.UseStaticFiles(); // Add MVC to the request pipeline. app.UseMvc(routes => { }); app.UseMvc(); }
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline. public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory) { loggerFactory.AddConsole(Configuration.GetSection("Logging")); loggerFactory.AddDebug(); app.UseMvc(); }
// Configure is called after ConfigureServices is called. public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory) { loggerFactory.MinimumLevel = LogLevel.Information; loggerFactory.AddConsole(); // Configure the HTTP request pipeline. // Add the following to the request pipeline only in development environment. if (env.IsDevelopment()) { app.UseBrowserLink(); app.UseErrorPage(ErrorPageOptions.ShowAll); } else { // Add Error handling middleware which catches all application specific errors and // send the request to the following path or controller action. app.UseErrorHandler("/Home/Error"); } // Add static files to the request pipeline. app.UseStaticFiles(); // Add MVC to the request pipeline. app.UseMvc(routes => { routes.MapRoute( name: "default", template: "{controller=Home}/{action=Index}/{id?}"); // Uncomment the following line to add a route for porting Web API 2 controllers. // routes.MapWebApiRoute("DefaultApi", "api/{controller}/{id?}"); }); }
public AccountController(IConfigurationRoot appSettings, UserManager<ApplicationUser> userManager, SignInManager<ApplicationUser> signInManager, ILoggerFactory loggerFactory) { _appSettings = appSettings; _userManager = userManager; _signInManager = signInManager; _logger = loggerFactory.CreateLogger<AccountController>(); }
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory) { loggerFactory.AddConsole(Configuration.GetSection("Logging")); loggerFactory.AddDebug(); app.UseIISPlatformHandler(); app.UseApplicationInsightsRequestTelemetry(); app.UseApplicationInsightsExceptionTelemetry(); app.UseStaticFiles(); app.Use(async (context, next) => { context.Response.Headers.Add("Access-Control-Allow-Origin", "*"); context.Response.Headers.Add("Access-Control-Allow-Methods", "GET, POST, PUT, DELETE, OPTIONS"); context.Response.Headers.Add("Access-Control-Allow-Headers", new[] { "Content-Type, x-xsrf-token" }); if (context.Request.Method == "OPTIONS") { context.Response.StatusCode = 200; } else { await next(); } }); app.UseMvc(); SampleData.Initialize(app.ApplicationServices); }
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline. public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory) { app.Run(async (context) => { await context.Response.WriteAsync("Hello World!"); }); }
public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory) { JwtSecurityTokenHandler.DefaultInboundClaimTypeMap.Clear(); loggerFactory.AddConsole(); loggerFactory.AddDebug(); app.UseDeveloperExceptionPage(); app.UseStaticFiles(); app.UseCookieAuthentication(new CookieAuthenticationOptions { AuthenticationScheme = "Cookies", AutomaticAuthenticate = true }); app.UseOpenIdConnectAuthentication(new OpenIdConnectOptions { AuthenticationScheme = "oidc", SignInScheme = "Cookies", Authority = "https://demo.identityserver.io", PostLogoutRedirectUri = "http://localhost:3308/", ClientId = "hybrid", ClientSecret = "secret", ResponseType = "code id_token", GetClaimsFromUserInfoEndpoint = true, SaveTokens = true }); app.UseMvcWithDefaultRoute(); }
public EndpointHandler(ILoggerFactory loggerFactory) { this._log = loggerFactory.Create(this); this._idByToken = new Dictionary<string, Identity>(); this._callbacks = new Dictionary<int, SendCallback>(); this._onMessage = new EventHandler<ChannelContext>(this.OnMessage); }
// Configure is called after ConfigureServices is called. public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory) { if(env.IsDevelopment()) { app.UseDeveloperExceptionPage(); } loggerFactory .AddConsole(Configuration.GetSection("Logging")) .AddDebug(); // Use the Default files ['index.html', 'index.htm', 'default.html', 'default.htm'] app.UseDefaultFiles() .UseStaticFiles() .UseIISPlatformHandler() .UseMvc(); // Setup a generic Quotes API EndPoint app.Map("/api/quotes", (config) => { app.Run(async context => { var quotes = "{ \"quotes\":" + " [ { \"quote\": \"Duct tape is like the force. It has a light side, a dark side, and it holds the universe together.\", \"author\":\"Oprah Winfrey\"} ]" + "}"; context.Response.ContentLength = quotes.Length; context.Response.ContentType = "application/json"; await context.Response.WriteAsync(quotes); }); }); }
public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory) { loggerFactory.MinimumLevel = LogLevel.Debug; loggerFactory.AddConsole(); ConfigureApplication(app); }
public MassTransitConsoleHostedService(IBusControl bus, ILoggerFactory loggerFactory) { _bus = bus; _logger = loggerFactory.CreateLogger <MassTransitConsoleHostedService>(); }
public UtxoIndexer(Network network, ChainIndexer chainIndexer, IBlockStore blockStore, ILoggerFactory loggerFactory) { this.network = network; this.chainIndexer = chainIndexer; this.blockStore = blockStore; this.logger = loggerFactory.CreateLogger(this.GetType().FullName); }
public NccGlobalExceptionFilter(ILoggerFactory loggerFactory) { _logger = loggerFactory.CreateLogger <NccGlobalExceptionFilter>(); }
public HttpStatusCodeExceptionMiddleware(RequestDelegate next, ILoggerFactory loggerFactory) { _next = next ?? throw new ArgumentNullException(nameof(next)); _logger = loggerFactory?.CreateLogger <HttpStatusCodeExceptionMiddleware>() ?? throw new ArgumentNullException(nameof(loggerFactory)); }
public ServiceRegistry(Func <HttpClient> httpClientFactory = null, ILoggerFactory loggerFactory = null, IConsulAclProvider aclProvider = null) { _logger = loggerFactory?.CreateLogger <ServiceRegistry>(); _client = httpClientFactory?.Invoke() ?? HttpUtils.CreateClient(aclProvider); }
public OrderingController(ILoggerFactory loggerFactory) { _logger = loggerFactory.CreateLogger <OrderingController>(); }
public PersistentEventQueryValidator(ExceptionlessElasticConfiguration configuration, ILoggerFactory loggerFactory) : base(configuration.Events.QueryParser, loggerFactory) { }
public WithLockingJob(ILoggerFactory loggerFactory) : base(loggerFactory) { _locker = new CacheLockProvider(new InMemoryCacheClient(loggerFactory), new InMemoryMessageBus(loggerFactory), loggerFactory); }
public CustomerRepository(IDbContext context, ILoggerFactory loggerFactory) { _context = context; _logger = loggerFactory.CreateLogger <CustomerRepository>(); }
public JoggingRoutesController(ILoggerFactory loggerFactory, IMediator mediator) : base(loggerFactory.CreateLogger <JoggingRoutesController>(), mediator) { }
public ValidateInputFilter(ILoggerFactory loggerFactory) { _logger = loggerFactory.CreateLogger <ValidateInputFilter>(); }
/// <summary> /// Initializes a new instance of the <see cref="HubConnectionContext"/> class. /// </summary> /// <param name="connectionContext">The underlying <see cref="ConnectionContext"/>.</param> /// <param name="keepAliveInterval">The keep alive interval. If no messages are sent by the server in this interval, a Ping message will be sent.</param> /// <param name="loggerFactory">The logger factory.</param> /// <param name="clientTimeoutInterval">Clients we haven't heard from in this interval are assumed to have disconnected.</param> public HubConnectionContext(ConnectionContext connectionContext, TimeSpan keepAliveInterval, ILoggerFactory loggerFactory, TimeSpan clientTimeoutInterval) : this(connectionContext, keepAliveInterval, loggerFactory, clientTimeoutInterval, HubOptionsSetup.DefaultStreamBufferCapacity) { }
public RequireSymbolsEnabled(IOptions <StorageConfiguration> scfg, ILoggerFactory logger) { this.Configuration = scfg.Value.Packages; this.Logger = logger.CreateLogger <RequireSymbolsEnabled>(); }
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline. public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory, IPathResolver pathResolver) { loggerFactory.AddSerilog(); if (env.IsDevelopment()) { app.UseDeveloperExceptionPage(); app.UseBrowserLink(); } else { app.UseExceptionHandler("/Home/Error"); } app.ApplicationServices.GetService <Data.Context>().Migrate(); app.UseResponseCompression(); // configure static files with 7 day cache app.UseStaticFiles(new StaticFileOptions() { OnPrepareResponse = _ => { var headers = _.Context.Response.GetTypedHeaders(); headers.CacheControl = new Microsoft.Net.Http.Headers.CacheControlHeaderValue() { MaxAge = TimeSpan.FromDays(7) }; } }); string contentPath = pathResolver.ResolveContentFilePath(); if (!Directory.Exists(contentPath)) { try { Directory.CreateDirectory(contentPath); } catch (Exception ex) { Console.WriteLine($"Unable to create directory '{contentPath}' in {Directory.GetCurrentDirectory()}"); throw (ex); } } string pathString = pathResolver.ResolveContentPath(); if (!pathString.StartsWith("/")) { pathString = "/" + pathString; } // configure /content with 7 day cache app.UseStaticFiles(new StaticFileOptions() { FileProvider = new PhysicalFileProvider(contentPath), RequestPath = new PathString(pathString), OnPrepareResponse = _ => { var headers = _.Context.Response.GetTypedHeaders(); headers.CacheControl = new Microsoft.Net.Http.Headers.CacheControlHeaderValue() { MaxAge = TimeSpan.FromDays(7) }; } }); app.UseSession(); // set cookie authentication options var cookieAuthOptions = new CookieAuthenticationOptions { AuthenticationScheme = Controllers.Authentication.SchemeGRACookie, LoginPath = new PathString("/SignIn/"), AccessDeniedPath = new PathString("/"), AutomaticAuthenticate = true, AutomaticChallenge = true }; // if there's a data protection path, set it up - for clustered/multi-server configs if (!string.IsNullOrEmpty(Configuration[ConfigurationKey.DataProtectionPath])) { string protectionPath = Configuration[ConfigurationKey.DataProtectionPath]; cookieAuthOptions.DataProtectionProvider = DataProtectionProvider.Create( new DirectoryInfo(Path.Combine(protectionPath, "cookies"))); } app.UseCookieAuthentication(cookieAuthOptions); // sitePath is also referenced in GRA.Controllers.Filter.SiteFilter app.UseMvc(routes => { routes.MapRoute( name: null, template: "{area:exists}/{controller=Home}/{action=Index}/{id?}"); routes.MapRoute( name: null, template: "{sitePath}/Info/{stub}", defaults: new { controller = "Info", action = "Index" }, constraints: new { sitePath = new SiteRouteConstraint(app.ApplicationServices.GetRequiredService <Controllers.Base.ISitePathValidator>()) }); routes.MapRoute( name: null, template: "Info/{stub}", defaults: new { controller = "Info", action = "Index" }); routes.MapRoute( name: null, template: "{sitePath}/{controller}/{action}/{id?}", defaults: new { controller = "Home", action = "Index" }, constraints: new { sitePath = new SiteRouteConstraint(app.ApplicationServices.GetRequiredService <Controllers.Base.ISitePathValidator>()) }); routes.MapRoute( name: null, template: "{controller=Home}/{action=Index}/{id?}"); }); }
/// <summary> /// Initializes a new instance of the <see cref="HubConnectionContext"/> class. /// </summary> /// <param name="connectionContext">The underlying <see cref="ConnectionContext"/>.</param> /// <param name="keepAliveInterval">The keep alive interval. If no messages are sent by the server in this interval, a Ping message will be sent.</param> /// <param name="loggerFactory">The logger factory.</param> /// <param name="clientTimeoutInterval">Clients we haven't heard from in this interval are assumed to have disconnected.</param> /// <param name="streamBufferCapacity">The buffer size for client upload streams</param> public HubConnectionContext(ConnectionContext connectionContext, TimeSpan keepAliveInterval, ILoggerFactory loggerFactory, TimeSpan clientTimeoutInterval, int streamBufferCapacity) { _connectionContext = connectionContext; _logger = loggerFactory.CreateLogger <HubConnectionContext>(); ConnectionAborted = _connectionAbortedTokenSource.Token; _keepAliveInterval = keepAliveInterval.Ticks; _clientTimeoutInterval = clientTimeoutInterval.Ticks; _streamBufferCapacity = streamBufferCapacity; }
public ActionExecutionLoggerFilter(ILoggerFactory loggerFactory) { _logger = loggerFactory.CreateLogger <ActionExecutionLoggerFilter>(); }
public void Configure(IApplicationBuilder app, ILoggerFactory loggerFactory) { loggerFactory.AddConsole(minLevel: LogLevel.Warning); app.UseStatusCodePagesWithRedirects("~/Home/StatusCodePage"); // Display custom error page in production when error occurs // During development use the ErrorPage middleware to display error information in the browser app.UseDeveloperExceptionPage(); app.UseDatabaseErrorPage(); // Configure Session. app.UseSession(); // Add static files to the request pipeline app.UseStaticFiles(); // Add cookie-based authentication to the request pipeline app.UseIdentity(); // Create an Azure Active directory application and copy paste the following var options = new OpenIdConnectOptions { Authority = "https://login.windows.net/[tenantName].onmicrosoft.com", ClientId = "c99497aa-3ee2-4707-b8a8-c33f51323fef", BackchannelHttpHandler = new OpenIdConnectBackChannelHttpHandler(), StringDataFormat = new CustomStringDataFormat(), StateDataFormat = new CustomStateDataFormat(), ResponseType = OpenIdConnectResponseType.CodeIdToken, UseTokenLifetime = false, Events = new OpenIdConnectEvents { OnMessageReceived = TestOpenIdConnectEvents.MessageReceived, OnAuthorizationCodeReceived = TestOpenIdConnectEvents.AuthorizationCodeReceived, OnRedirectToIdentityProvider = TestOpenIdConnectEvents.RedirectToIdentityProvider, OnTokenValidated = TestOpenIdConnectEvents.TokenValidated, } }; options.TokenValidationParameters.ValidateLifetime = false; options.ProtocolValidator.RequireNonce = true; options.ProtocolValidator.NonceLifetime = TimeSpan.FromDays(36500); app.UseOpenIdConnectAuthentication(options); // Add MVC to the request pipeline app.UseMvc(routes => { routes.MapRoute( name: "areaRoute", template: "{area:exists}/{controller}/{action}", defaults: new { action = "Index" }); routes.MapRoute( name: "default", template: "{controller}/{action}/{id?}", defaults: new { controller = "Home", action = "Index" }); routes.MapRoute( name: "api", template: "{controller}/{id?}"); }); //Populates the MusicStore sample data SampleData.InitializeMusicStoreDatabaseAsync(app.ApplicationServices).Wait(); }
public FirstController(ILogger <FirstController> logger, ILoggerFactory loggerFactory) { _logger = logger; this._loggerFactory = loggerFactory; }
public ShowMarketNames(ILoggerFactory loggerFactory = null) { _loggerFactory = loggerFactory; _log = _loggerFactory?.CreateLogger(typeof(ShowMarketNames)) ?? new NullLogger <ShowMarketNames>(); }
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline. public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory) { loggerFactory.AddConsole(Configuration.GetSection("Logging")); loggerFactory.AddDebug(); if (env.IsDevelopment()) { app.UseDeveloperExceptionPage(); app.UseBrowserLink(); } else { app.UseExceptionHandler("/Home/Error"); } #region 中间件测试1 //app.Use(next => //{ // return async context => // { // await context.Response.WriteAsync("<h1>I'm Middleware1</1>"); // await next(context); //注释掉后将不再调用后面的中间件 // }; //}); //app.Use(next => //{ // return async context => // { // await context.Response.WriteAsync("<h1>I'm Middleware2</1>"); // await next(context); //注释掉后将不再调用后面的中间件 // }; //}); //app.Use(next => //{ // return async context => // { // await context.Response.WriteAsync("<h1>I'm Middleware3</1>"); // await next(context); //注释掉后将不再调用后面的中间件 // }; //}); #endregion #region Map 测试 app.Map("/Home/About", a => { a.Use(next => { return(async context => { await context.Response.WriteAsync("<h1>From a Map pipeline!</h1>"); }); }); }); #endregion #region MapWhen 测试 //有大概20%概率进入这条管道 app.MapWhen(context => { var lucky = new Random(DateTime.Now.Second).Next(); return(lucky % 5 == 0); }, a => { a.Use(next => { return(async context => { await context.Response.WriteAsync("<h1>GoodLuck! From a MapWhen pipeline</h1>"); }); }); }); #endregion app.UseStaticFiles(); //添加时间记录中间件 app.UseTimeMiddleware(); app.UseMvc(routes => { routes.MapRoute( name: "default", template: "{controller=Home}/{action=Index}/{id?}"); }); }
public ZohoEmailSender(IConfiguration configuration, ILoggerFactory logger) { _configuration = configuration; _log = logger.CreateLogger("ZohoEmailSender"); }
/*Section="Constructor"*/ public NotificationGroupController( ILoggerFactory loggerFactory, INotificationGroupService notificationGroupService) : base(loggerFactory, notificationGroupService) { }
public AspNetCoreMessageBusDependencyResolver(IServiceProvider serviceProvider, ILoggerFactory loggerFactory, IHttpContextAccessor httpContextAccessor) : base(serviceProvider, loggerFactory) { _logger = loggerFactory.CreateLogger <AspNetCoreMessageBusDependencyResolver>(); _httpContextAccessor = httpContextAccessor; }
public void Configure(IApplicationBuilder app, IWebHostEnvironment env, WebStoreDBInitializer db, ILoggerFactory log) { log.AddLog4Net(); db.Initialize(); if (env.IsDevelopment()) { app.UseDeveloperExceptionPage(); } app.UseRouting(); app.UseAuthorization(); app.UseSwagger(); app.UseSwaggerUI(opt => { opt.SwaggerEndpoint("/swagger/v1/swagger.json", "WebStore.API"); opt.RoutePrefix = string.Empty; }); app.UseEndpoints(endpoints => { endpoints.MapControllers(); }); }
public IMetricReporter CreateMetricReporter(string name, ILoggerFactory loggerFactory) { return(new TestMetricReporter(_pass, _reportInterval, _throwEx)); }
public void Configure(IApplicationBuilder app, IWebHostEnvironment env, ILoggerFactory loggerFactory) { app.InitializeApplication(); }
public RequestLoggingMiddleware(RequestDelegate next, ILoggerFactory loggerFactory) { _next = next; _logger = loggerFactory.CreateLogger <RequestLoggingMiddleware>(); _recyclableMemoryStreamManager = new RecyclableMemoryStreamManager(); }
public AWNotCountedAnnotationFacetFactoryParallel(AppendFacetFactoryOrder <AWNotCountedAnnotationFacetFactoryParallel> order, ILoggerFactory loggerFactory) : base(order.Order, loggerFactory, FeatureType.Collections) { }
public MyCartController(UserManager<ApplicationUser> userManager, SignInManager<ApplicationUser> signInManager, RoleManager<Role> role, ApplicationDbContext context, ILoggerFactory loggerFactory, IHostingEnvironment hostingEnv, IOptions<AppSettings> appSettings) : base(userManager, signInManager, role, context, loggerFactory, hostingEnv, appSettings) { }
private static void AddDataBaseInfo(IConfiguration config, string containerName, string providerName, string serviceName = null, ILoggerFactory loggerFactory = null) { var section = config.GetSection(SKYNET).GetSection(SKYNET_CLOUD); var defaultContainer = section.GetValue <string>(SKYNET_CLOUD_SERVICE_DBNAME, "upms"); var isFromDB = section.GetValue <bool>(SKYNET_CLOUD_SERVICE_FROM, false); var useDbRoute = section.GetValue <bool>(SKYNET_CLOUD_SERVICE_ROUTE, false); var moduleAssmbly = section.GetValue <string>(SKYNET_CLOUD_SERVICE_ENTITY, "Skynet.Cloud.Framework"); //"DB_Oracle_ConnStr" var dbConnectionString = config.GetConnectionString(containerName); if (dbConnectionString.IsNullOrEmpty()) { switch (providerName) { case DbProviderNames.Oracle: dbConnectionString = BuildeOracleConnectionString(config, serviceName); break; case DbProviderNames.MySQL: dbConnectionString = BuildeMysqlConnectionString(config, serviceName); break; case DbProviderNames.SqlServer: dbConnectionString = BuildeSqlServerConnectionString(config, serviceName); break; } } if (!string.IsNullOrEmpty(defaultContainer)) { AddMainDb(containerName, dbConnectionString, providerName, moduleAssmbly, isFromDB, defaultContainer, loggerFactory); } if (useDbRoute) { AddRouteDb(containerName, dbConnectionString, providerName, moduleAssmbly, loggerFactory); } }
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline. public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory) { loggerFactory.AddConsole(Configuration.GetSection("Logging")); loggerFactory.AddDebug(); if (env.IsDevelopment()) { app.UseDeveloperExceptionPage(); } else { app.UseExceptionHandler("/Home/Error"); } app.UseStaticFiles(); app.UseWebMarkupMin(); app.UseMvc(routes => { routes.MapRoute( name: "default", template: "{controller=Home}/{action=Index}/{id?}"); }); }
// Configure is called after ConfigureServices is called. public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory) { loggerFactory.AddConsole(Configuration.GetSection("Logging")); loggerFactory.AddDebug(); // Add the following to the request pipeline only in development environment. if (env.IsDevelopment()) { app.UseDeveloperExceptionPage(); } else { // Add Error handling middleware which catches all application specific errors and // send the request to the following path or controller action. app.UseExceptionHandler("/Home/Error"); } // Add the platform handler to the request pipeline. app.UseIISPlatformHandler(); // Add static files to the request pipeline. app.UseStaticFiles(); // Add MVC to the request pipeline. app.UseMvc(routes => { routes.MapRoute( name: "default", template: "{controller=Home}/{action=Index}/{id?}"); routes.MapRoute("DefaultApi", "api/{controller}/{id?}"); }); }
public DefaultVirtualPathProvider( IHostEnvironment hostEnvironment, ILoggerFactory loggerFactory) { _hostEnvironment = hostEnvironment; _logger = loggerFactory.CreateLogger<DefaultVirtualPathProvider>(); }
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline. public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory) { loggerFactory.AddConsole(Configuration.GetSection("Logging")); loggerFactory.AddDebug(); var section = Configuration.GetSection("MongoDB"); if (env.IsDevelopment()) { app.UseDeveloperExceptionPage(); } else { app.UseExceptionHandler("/Home/Error"); } app.UseIISPlatformHandler(); app.UseCors("AllowAll"); app.UseStaticFiles(); app.UseMvc(routes => { routes.MapRoute( name:"api", template: "api/{controller}/{id?}" ); }); }
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline. public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory) { SuperDataBase.Configure(env, app.ApplicationServices.GetService<IOptions<AppConfig>>()); loggerFactory.AddConsole(Configuration.GetSection("Logging")); loggerFactory.AddDebug(); if (env.IsDevelopment()) { app.UseBrowserLink(); app.UseDeveloperExceptionPage(); } else { app.UseExceptionHandler("/Home/Error"); } app.UseIISPlatformHandler(); app.UseStaticFiles(); app.UseMvc(routes => { routes.MapRoute( name: "default", template: "{controller=Home}/{action=Index}/{id?}"); }); }
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline. public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory) { loggerFactory.AddConsole(Configuration.GetSection("Logging")); loggerFactory.AddDebug(); if (env.IsDevelopment()) { app.UseBrowserLink(); app.UseDeveloperExceptionPage(); app.UseDatabaseErrorPage(); } else { app.UseExceptionHandler("/Home/Error"); } app.UseIISPlatformHandler(options => options.AuthenticationDescriptions.Clear()); app.UseStaticFiles(); app.UseIdentity(); // To configure external authentication please see http://go.microsoft.com/fwlink/?LinkID=532715 app.UseMvc(routes => { routes.MapRoute( name: "default", template: "{controller=Home}/{action=Index}/{id?}"); }); }