選択できるのは25トピックまでです。 トピックは、先頭が英数字で、英数字とダッシュ('-')を使用した35文字以内のものにしてください。

Startup.cs 2.0KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. using Luticate2.Auth.Controllers;
  2. using Microsoft.AspNetCore.Builder;
  3. using Microsoft.AspNetCore.Hosting;
  4. using Microsoft.Extensions.Configuration;
  5. using Microsoft.Extensions.DependencyInjection;
  6. using Microsoft.Extensions.Logging;
  7. namespace WebTest
  8. {
  9. public class Startup
  10. {
  11. public Startup(IHostingEnvironment env)
  12. {
  13. var builder = new ConfigurationBuilder()
  14. .SetBasePath(env.ContentRootPath)
  15. .AddJsonFile("appsettings.json", optional: true, reloadOnChange: true)
  16. .AddJsonFile($"appsettings.{env.EnvironmentName}.json", optional: true);
  17. if (env.IsEnvironment("Development"))
  18. {
  19. // This will push telemetry data through Application Insights pipeline faster, allowing you to view results immediately.
  20. builder.AddApplicationInsightsSettings(developerMode: true);
  21. }
  22. builder.AddEnvironmentVariables();
  23. Configuration = builder.Build();
  24. }
  25. public IConfigurationRoot Configuration { get; }
  26. // This method gets called by the runtime. Use this method to add services to the container
  27. public void ConfigureServices(IServiceCollection services)
  28. {
  29. // Add framework services.
  30. services.AddApplicationInsightsTelemetry(Configuration);
  31. services.AddLuticate();
  32. services.AddMvc()
  33. .AddLuticate();
  34. }
  35. // This method gets called by the runtime. Use this method to configure the HTTP request pipeline
  36. public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory)
  37. {
  38. loggerFactory.AddConsole(Configuration.GetSection("Logging"));
  39. loggerFactory.AddDebug();
  40. app.UseApplicationInsightsRequestTelemetry();
  41. app.UseApplicationInsightsExceptionTelemetry();
  42. app.UseMvc();
  43. app.UseLuticate();
  44. }
  45. }
  46. }