From e2c367961ad90b5402b82252d19112a867606e31 Mon Sep 17 00:00:00 2001 From: SHM Date: Wed, 17 Dec 2025 11:03:41 +0900 Subject: [PATCH] =?UTF-8?q?[=EC=84=B1=ED=98=84=EB=AA=A8]=20WebApi=20ProxyK?= =?UTF-8?q?MS=20=ED=94=84=EB=A1=9C=EC=A0=9D=ED=8A=B8=20=EC=83=9D=EC=84=B1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Controllers/WeatherForecastController.cs | 33 +++++++++++++++ .../WebApi/WebApi.Project.ProxyKMS/Program.cs | 25 +++++++++++ .../Properties/launchSettings.json | 41 +++++++++++++++++++ .../WeatherForecast.cs | 13 ++++++ .../WebApi.Project.ProxyKMS.csproj | 13 ++++++ .../WebApi.Project.ProxyKMS.http | 6 +++ .../appsettings.Development.json | 8 ++++ .../WebApi.Project.ProxyKMS/appsettings.json | 9 ++++ Projects/WebApi/WebApi.sln | 6 +++ 9 files changed, 154 insertions(+) create mode 100644 Projects/WebApi/WebApi.Project.ProxyKMS/Controllers/WeatherForecastController.cs create mode 100644 Projects/WebApi/WebApi.Project.ProxyKMS/Program.cs create mode 100644 Projects/WebApi/WebApi.Project.ProxyKMS/Properties/launchSettings.json create mode 100644 Projects/WebApi/WebApi.Project.ProxyKMS/WeatherForecast.cs create mode 100644 Projects/WebApi/WebApi.Project.ProxyKMS/WebApi.Project.ProxyKMS.csproj create mode 100644 Projects/WebApi/WebApi.Project.ProxyKMS/WebApi.Project.ProxyKMS.http create mode 100644 Projects/WebApi/WebApi.Project.ProxyKMS/appsettings.Development.json create mode 100644 Projects/WebApi/WebApi.Project.ProxyKMS/appsettings.json diff --git a/Projects/WebApi/WebApi.Project.ProxyKMS/Controllers/WeatherForecastController.cs b/Projects/WebApi/WebApi.Project.ProxyKMS/Controllers/WeatherForecastController.cs new file mode 100644 index 0000000..e135901 --- /dev/null +++ b/Projects/WebApi/WebApi.Project.ProxyKMS/Controllers/WeatherForecastController.cs @@ -0,0 +1,33 @@ +using Microsoft.AspNetCore.Mvc; + +namespace WebApi.Project.ProxyKMS.Controllers +{ + [ApiController] + [Route("[controller]")] + public class WeatherForecastController : ControllerBase + { + private static readonly string[] Summaries = new[] + { + "Freezing", "Bracing", "Chilly", "Cool", "Mild", "Warm", "Balmy", "Hot", "Sweltering", "Scorching" + }; + + private readonly ILogger _logger; + + public WeatherForecastController(ILogger logger) + { + _logger = logger; + } + + [HttpGet(Name = "GetWeatherForecast")] + public IEnumerable Get() + { + return Enumerable.Range(1, 5).Select(index => new WeatherForecast + { + Date = DateOnly.FromDateTime(DateTime.Now.AddDays(index)), + TemperatureC = Random.Shared.Next(-20, 55), + Summary = Summaries[Random.Shared.Next(Summaries.Length)] + }) + .ToArray(); + } + } +} diff --git a/Projects/WebApi/WebApi.Project.ProxyKMS/Program.cs b/Projects/WebApi/WebApi.Project.ProxyKMS/Program.cs new file mode 100644 index 0000000..48863a6 --- /dev/null +++ b/Projects/WebApi/WebApi.Project.ProxyKMS/Program.cs @@ -0,0 +1,25 @@ +var builder = WebApplication.CreateBuilder(args); + +// Add services to the container. + +builder.Services.AddControllers(); +// Learn more about configuring Swagger/OpenAPI at https://aka.ms/aspnetcore/swashbuckle +builder.Services.AddEndpointsApiExplorer(); +builder.Services.AddSwaggerGen(); + +var app = builder.Build(); + +// Configure the HTTP request pipeline. +if (app.Environment.IsDevelopment()) +{ + app.UseSwagger(); + app.UseSwaggerUI(); +} + +app.UseHttpsRedirection(); + +app.UseAuthorization(); + +app.MapControllers(); + +app.Run(); diff --git a/Projects/WebApi/WebApi.Project.ProxyKMS/Properties/launchSettings.json b/Projects/WebApi/WebApi.Project.ProxyKMS/Properties/launchSettings.json new file mode 100644 index 0000000..3d5d199 --- /dev/null +++ b/Projects/WebApi/WebApi.Project.ProxyKMS/Properties/launchSettings.json @@ -0,0 +1,41 @@ +{ + "$schema": "http://json.schemastore.org/launchsettings.json", + "iisSettings": { + "windowsAuthentication": false, + "anonymousAuthentication": true, + "iisExpress": { + "applicationUrl": "http://localhost:29918", + "sslPort": 44332 + } + }, + "profiles": { + "http": { + "commandName": "Project", + "dotnetRunMessages": true, + "launchBrowser": true, + "launchUrl": "swagger", + "applicationUrl": "http://localhost:5298", + "environmentVariables": { + "ASPNETCORE_ENVIRONMENT": "Development" + } + }, + "https": { + "commandName": "Project", + "dotnetRunMessages": true, + "launchBrowser": true, + "launchUrl": "swagger", + "applicationUrl": "https://localhost:7114;http://localhost:5298", + "environmentVariables": { + "ASPNETCORE_ENVIRONMENT": "Development" + } + }, + "IIS Express": { + "commandName": "IISExpress", + "launchBrowser": true, + "launchUrl": "swagger", + "environmentVariables": { + "ASPNETCORE_ENVIRONMENT": "Development" + } + } + } +} diff --git a/Projects/WebApi/WebApi.Project.ProxyKMS/WeatherForecast.cs b/Projects/WebApi/WebApi.Project.ProxyKMS/WeatherForecast.cs new file mode 100644 index 0000000..007677f --- /dev/null +++ b/Projects/WebApi/WebApi.Project.ProxyKMS/WeatherForecast.cs @@ -0,0 +1,13 @@ +namespace WebApi.Project.ProxyKMS +{ + public class WeatherForecast + { + public DateOnly Date { get; set; } + + public int TemperatureC { get; set; } + + public int TemperatureF => 32 + (int)(TemperatureC / 0.5556); + + public string? Summary { get; set; } + } +} diff --git a/Projects/WebApi/WebApi.Project.ProxyKMS/WebApi.Project.ProxyKMS.csproj b/Projects/WebApi/WebApi.Project.ProxyKMS/WebApi.Project.ProxyKMS.csproj new file mode 100644 index 0000000..5419ef0 --- /dev/null +++ b/Projects/WebApi/WebApi.Project.ProxyKMS/WebApi.Project.ProxyKMS.csproj @@ -0,0 +1,13 @@ + + + + net8.0 + enable + enable + + + + + + + diff --git a/Projects/WebApi/WebApi.Project.ProxyKMS/WebApi.Project.ProxyKMS.http b/Projects/WebApi/WebApi.Project.ProxyKMS/WebApi.Project.ProxyKMS.http new file mode 100644 index 0000000..6efb757 --- /dev/null +++ b/Projects/WebApi/WebApi.Project.ProxyKMS/WebApi.Project.ProxyKMS.http @@ -0,0 +1,6 @@ +@WebApi.Project.ProxyKMS_HostAddress = http://localhost:5298 + +GET {{WebApi.Project.ProxyKMS_HostAddress}}/weatherforecast/ +Accept: application/json + +### diff --git a/Projects/WebApi/WebApi.Project.ProxyKMS/appsettings.Development.json b/Projects/WebApi/WebApi.Project.ProxyKMS/appsettings.Development.json new file mode 100644 index 0000000..0c208ae --- /dev/null +++ b/Projects/WebApi/WebApi.Project.ProxyKMS/appsettings.Development.json @@ -0,0 +1,8 @@ +{ + "Logging": { + "LogLevel": { + "Default": "Information", + "Microsoft.AspNetCore": "Warning" + } + } +} diff --git a/Projects/WebApi/WebApi.Project.ProxyKMS/appsettings.json b/Projects/WebApi/WebApi.Project.ProxyKMS/appsettings.json new file mode 100644 index 0000000..10f68b8 --- /dev/null +++ b/Projects/WebApi/WebApi.Project.ProxyKMS/appsettings.json @@ -0,0 +1,9 @@ +{ + "Logging": { + "LogLevel": { + "Default": "Information", + "Microsoft.AspNetCore": "Warning" + } + }, + "AllowedHosts": "*" +} diff --git a/Projects/WebApi/WebApi.sln b/Projects/WebApi/WebApi.sln index c692239..af1fb8d 100644 --- a/Projects/WebApi/WebApi.sln +++ b/Projects/WebApi/WebApi.sln @@ -15,6 +15,8 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Config", "Config", "{C8D527 EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WebApi.Project.UniqueKeyApi", "WebApi.Project.UniqueKeyApi\WebApi.Project.UniqueKeyApi.csproj", "{3DDF6187-1294-48BC-B664-1C74AE73080A}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WebApi.Project.ProxyKMS", "WebApi.Project.ProxyKMS\WebApi.Project.ProxyKMS.csproj", "{90836F51-20F9-4C45-86DB-BFDD390E53B7}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -33,6 +35,10 @@ Global {3DDF6187-1294-48BC-B664-1C74AE73080A}.Debug|Any CPU.Build.0 = Debug|Any CPU {3DDF6187-1294-48BC-B664-1C74AE73080A}.Release|Any CPU.ActiveCfg = Release|Any CPU {3DDF6187-1294-48BC-B664-1C74AE73080A}.Release|Any CPU.Build.0 = Release|Any CPU + {90836F51-20F9-4C45-86DB-BFDD390E53B7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {90836F51-20F9-4C45-86DB-BFDD390E53B7}.Debug|Any CPU.Build.0 = Debug|Any CPU + {90836F51-20F9-4C45-86DB-BFDD390E53B7}.Release|Any CPU.ActiveCfg = Release|Any CPU + {90836F51-20F9-4C45-86DB-BFDD390E53B7}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE