From c15445372b7cca0fbb32b03bd9eb89d251103029 Mon Sep 17 00:00:00 2001 From: Lennart Wagner Date: Fri, 14 Jul 2023 21:33:18 +0200 Subject: [PATCH] initial --- .gitignore | 14 +++++++ ExampleWebService.sln | 25 +++++++++++ ExampleWebService/ExampleWebService.csproj | 9 ++++ ExampleWebService/Program.cs | 34 +++++++++++++++ .../Properties/launchSettings.json | 41 +++++++++++++++++++ .../appsettings.Development.json | 8 ++++ ExampleWebService/appsettings.json | 9 ++++ 7 files changed, 140 insertions(+) create mode 100644 .gitignore create mode 100644 ExampleWebService.sln create mode 100644 ExampleWebService/ExampleWebService.csproj create mode 100644 ExampleWebService/Program.cs create mode 100644 ExampleWebService/Properties/launchSettings.json create mode 100644 ExampleWebService/appsettings.Development.json create mode 100644 ExampleWebService/appsettings.json diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..f582bef --- /dev/null +++ b/.gitignore @@ -0,0 +1,14 @@ +*.bak +*.log +*.suo +*.tmp +*.user +*.received.txt + +**/.nuget/** +**/.vs/** +**/Backup/** +**/TestResults/** +**/_UpgradeReport_Files/** +**/bin/** +**/obj/** diff --git a/ExampleWebService.sln b/ExampleWebService.sln new file mode 100644 index 0000000..545e61b --- /dev/null +++ b/ExampleWebService.sln @@ -0,0 +1,25 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 17 +VisualStudioVersion = 17.6.33815.320 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ExampleWebService", "ExampleWebService\ExampleWebService.csproj", "{7CC49B80-AE0A-41A1-9F90-D78354EBCC20}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {7CC49B80-AE0A-41A1-9F90-D78354EBCC20}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {7CC49B80-AE0A-41A1-9F90-D78354EBCC20}.Debug|Any CPU.Build.0 = Debug|Any CPU + {7CC49B80-AE0A-41A1-9F90-D78354EBCC20}.Release|Any CPU.ActiveCfg = Release|Any CPU + {7CC49B80-AE0A-41A1-9F90-D78354EBCC20}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {B9507D3F-BC70-48B7-BD38-5F4D756AED2B} + EndGlobalSection +EndGlobal diff --git a/ExampleWebService/ExampleWebService.csproj b/ExampleWebService/ExampleWebService.csproj new file mode 100644 index 0000000..4c2bb77 --- /dev/null +++ b/ExampleWebService/ExampleWebService.csproj @@ -0,0 +1,9 @@ + + + + net7.0 + enable + enable + + + diff --git a/ExampleWebService/Program.cs b/ExampleWebService/Program.cs new file mode 100644 index 0000000..9a6d4cb --- /dev/null +++ b/ExampleWebService/Program.cs @@ -0,0 +1,34 @@ +var builder = WebApplication.CreateBuilder(args); + +// Add services to the container. + +var app = builder.Build(); + +// Configure the HTTP request pipeline. + +app.UseHttpsRedirection(); + +var summaries = new[] +{ + "Freezing", "Bracing", "Chilly", "Cool", "Mild", "Warm", "Balmy", "Hot", "Sweltering", "Scorching" +}; + +app.MapGet("/weatherforecast", () => +{ + var forecast = Enumerable.Range(1, 5).Select(index => + new WeatherForecast + ( + DateOnly.FromDateTime(DateTime.Now.AddDays(index)), + Random.Shared.Next(-20, 55), + summaries[Random.Shared.Next(summaries.Length)] + )) + .ToArray(); + return forecast; +}); + +app.Run(); + +internal record WeatherForecast(DateOnly Date, int TemperatureC, string? Summary) +{ + public int TemperatureF => 32 + (int)(TemperatureC / 0.5556); +} diff --git a/ExampleWebService/Properties/launchSettings.json b/ExampleWebService/Properties/launchSettings.json new file mode 100644 index 0000000..636b759 --- /dev/null +++ b/ExampleWebService/Properties/launchSettings.json @@ -0,0 +1,41 @@ +{ + "$schema": "https://json.schemastore.org/launchsettings.json", + "iisSettings": { + "windowsAuthentication": false, + "anonymousAuthentication": true, + "iisExpress": { + "applicationUrl": "http://localhost:61991", + "sslPort": 44300 + } + }, + "profiles": { + "http": { + "commandName": "Project", + "dotnetRunMessages": true, + "launchBrowser": true, + "launchUrl": "weatherforecast", + "applicationUrl": "http://localhost:5244", + "environmentVariables": { + "ASPNETCORE_ENVIRONMENT": "Development" + } + }, + "https": { + "commandName": "Project", + "dotnetRunMessages": true, + "launchBrowser": true, + "launchUrl": "weatherforecast", + "applicationUrl": "https://localhost:7001;http://localhost:5244", + "environmentVariables": { + "ASPNETCORE_ENVIRONMENT": "Development" + } + }, + "IIS Express": { + "commandName": "IISExpress", + "launchBrowser": true, + "launchUrl": "weatherforecast", + "environmentVariables": { + "ASPNETCORE_ENVIRONMENT": "Development" + } + } + } +} diff --git a/ExampleWebService/appsettings.Development.json b/ExampleWebService/appsettings.Development.json new file mode 100644 index 0000000..0c208ae --- /dev/null +++ b/ExampleWebService/appsettings.Development.json @@ -0,0 +1,8 @@ +{ + "Logging": { + "LogLevel": { + "Default": "Information", + "Microsoft.AspNetCore": "Warning" + } + } +} diff --git a/ExampleWebService/appsettings.json b/ExampleWebService/appsettings.json new file mode 100644 index 0000000..10f68b8 --- /dev/null +++ b/ExampleWebService/appsettings.json @@ -0,0 +1,9 @@ +{ + "Logging": { + "LogLevel": { + "Default": "Information", + "Microsoft.AspNetCore": "Warning" + } + }, + "AllowedHosts": "*" +}