| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101 |
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Threading.Tasks;
- using Microsoft.AspNetCore.Builder;
- using Microsoft.AspNetCore.Hosting;
- using Microsoft.AspNetCore.HttpsPolicy;
- using Microsoft.AspNetCore.Mvc;
- using Microsoft.Extensions.Configuration;
- using Microsoft.Extensions.DependencyInjection;
- using Microsoft.Extensions.Hosting;
- using Microsoft.Extensions.Logging;
- using log4net;
- using Microsoft.Extensions.Caching.Memory;
- using Newtonsoft.Json.Serialization;
- using Microsoft.Net.Http.Headers;
- using ApiProcess.Process;
- using Microsoft.AspNetCore.Server.Kestrel.Core;
- namespace ApiProcess
- {
- public class Startup
- {
- static string CACHE_KEY = "CacheKey";
- public Startup(IConfiguration configuration)
- {
- Configuration = configuration;
- }
- public IConfiguration Configuration { get; }
- // This method gets called by the runtime. Use this method to add services to the container.
- public void ConfigureServices(IServiceCollection services)
- {
- /*
-
- services.AddControllers();
- services.AddMemoryCache();
- services.AddMvc(setupAction => {
- setupAction.EnableEndpointRouting = false;
- }).AddJsonOptions(jsonOptions =>
- {
- jsonOptions.JsonSerializerOptions.PropertyNamingPolicy = null;
- })
- .AddXmlSerializerFormatters()
- .SetCompatibilityVersion(CompatibilityVersion.Version_3_0);
- */
- services.AddMvc(setupAction => {
- setupAction.EnableEndpointRouting = false;
- }).AddJsonOptions(jsonOptions =>
- {
- jsonOptions.JsonSerializerOptions.PropertyNamingPolicy = null;
- })
- .AddXmlSerializerFormatters()
- .SetCompatibilityVersion(CompatibilityVersion.Version_3_0);
- services.Configure<KestrelServerOptions>(options =>
- {
- options.Limits.MaxRequestBodySize = int.MaxValue; // if don't set default value is: 30 MB
- });
- //string conn = Common.GetValuesAppSetting("api", "Connection");
- //services.AddDbContext<ModelContext>(options => options.UseOracle(conn));
- Variable.LoadConfigData();
- }
- // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
- public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
- {
- if (env.IsDevelopment())
- {
- app.UseDeveloperExceptionPage();
- }
- app.UseHttpsRedirection();
- app.UseRouting();
- app.UseAuthorization();
- app.UseEndpoints(endpoints =>
- {
- endpoints.MapControllers();
- });
-
- }
-
- }
- }
|