测试
This commit is contained in:
41
SimpleAPI/Program.cs
Normal file
41
SimpleAPI/Program.cs
Normal file
@@ -0,0 +1,41 @@
|
||||
var builder = WebApplication.CreateBuilder(args);
|
||||
|
||||
// Add services to the container.
|
||||
// Learn more about configuring OpenAPI at https://aka.ms/aspnet/openapi
|
||||
builder.Services.AddOpenApi();
|
||||
|
||||
var app = builder.Build();
|
||||
|
||||
// Configure the HTTP request pipeline.
|
||||
if (app.Environment.IsDevelopment())
|
||||
{
|
||||
app.MapOpenApi();
|
||||
}
|
||||
|
||||
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;
|
||||
})
|
||||
.WithName("GetWeatherForecast");
|
||||
|
||||
app.Run();
|
||||
|
||||
record WeatherForecast(DateOnly Date, int TemperatureC, string? Summary)
|
||||
{
|
||||
public int TemperatureF => 32 + (int)(TemperatureC / 0.5556);
|
||||
}
|
||||
23
SimpleAPI/Properties/launchSettings.json
Normal file
23
SimpleAPI/Properties/launchSettings.json
Normal file
@@ -0,0 +1,23 @@
|
||||
{
|
||||
"$schema": "https://json.schemastore.org/launchsettings.json",
|
||||
"profiles": {
|
||||
"http": {
|
||||
"commandName": "Project",
|
||||
"dotnetRunMessages": true,
|
||||
"launchBrowser": false,
|
||||
"applicationUrl": "http://localhost:5256",
|
||||
"environmentVariables": {
|
||||
"ASPNETCORE_ENVIRONMENT": "Development"
|
||||
}
|
||||
},
|
||||
"https": {
|
||||
"commandName": "Project",
|
||||
"dotnetRunMessages": true,
|
||||
"launchBrowser": false,
|
||||
"applicationUrl": "https://localhost:7149;http://localhost:5256",
|
||||
"environmentVariables": {
|
||||
"ASPNETCORE_ENVIRONMENT": "Development"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
13
SimpleAPI/SimpleAPI.csproj
Normal file
13
SimpleAPI/SimpleAPI.csproj
Normal file
@@ -0,0 +1,13 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk.Web">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net9.0</TargetFramework>
|
||||
<Nullable>enable</Nullable>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.AspNetCore.OpenApi" Version="9.0.8" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
6
SimpleAPI/SimpleAPI.http
Normal file
6
SimpleAPI/SimpleAPI.http
Normal file
@@ -0,0 +1,6 @@
|
||||
@SimpleAPI_HostAddress = http://localhost:5256
|
||||
|
||||
GET {{SimpleAPI_HostAddress}}/weatherforecast/
|
||||
Accept: application/json
|
||||
|
||||
###
|
||||
8
SimpleAPI/appsettings.Development.json
Normal file
8
SimpleAPI/appsettings.Development.json
Normal file
@@ -0,0 +1,8 @@
|
||||
{
|
||||
"Logging": {
|
||||
"LogLevel": {
|
||||
"Default": "Information",
|
||||
"Microsoft.AspNetCore": "Warning"
|
||||
}
|
||||
}
|
||||
}
|
||||
9
SimpleAPI/appsettings.json
Normal file
9
SimpleAPI/appsettings.json
Normal file
@@ -0,0 +1,9 @@
|
||||
{
|
||||
"Logging": {
|
||||
"LogLevel": {
|
||||
"Default": "Information",
|
||||
"Microsoft.AspNetCore": "Warning"
|
||||
}
|
||||
},
|
||||
"AllowedHosts": "*"
|
||||
}
|
||||
86
SimpleAPI/obj/SimpleAPI.csproj.nuget.dgspec.json
Normal file
86
SimpleAPI/obj/SimpleAPI.csproj.nuget.dgspec.json
Normal file
@@ -0,0 +1,86 @@
|
||||
{
|
||||
"format": 1,
|
||||
"restore": {
|
||||
"C:\\work\\电脑硬件-01\\SimpleAPI\\SimpleAPI.csproj": {}
|
||||
},
|
||||
"projects": {
|
||||
"C:\\work\\电脑硬件-01\\SimpleAPI\\SimpleAPI.csproj": {
|
||||
"version": "1.0.0",
|
||||
"restore": {
|
||||
"projectUniqueName": "C:\\work\\电脑硬件-01\\SimpleAPI\\SimpleAPI.csproj",
|
||||
"projectName": "SimpleAPI",
|
||||
"projectPath": "C:\\work\\电脑硬件-01\\SimpleAPI\\SimpleAPI.csproj",
|
||||
"packagesPath": "C:\\Users\\代\\.nuget\\packages\\",
|
||||
"outputPath": "C:\\work\\电脑硬件-01\\SimpleAPI\\obj\\",
|
||||
"projectStyle": "PackageReference",
|
||||
"fallbackFolders": [
|
||||
"C:\\Program Files (x86)\\Microsoft Visual Studio\\Shared\\NuGetPackages"
|
||||
],
|
||||
"configFilePaths": [
|
||||
"C:\\Users\\代\\AppData\\Roaming\\NuGet\\NuGet.Config",
|
||||
"C:\\Program Files (x86)\\NuGet\\Config\\Microsoft.VisualStudio.FallbackLocation.config",
|
||||
"C:\\Program Files (x86)\\NuGet\\Config\\Microsoft.VisualStudio.Offline.config"
|
||||
],
|
||||
"originalTargetFrameworks": [
|
||||
"net9.0"
|
||||
],
|
||||
"sources": {
|
||||
"C:\\Program Files (x86)\\Microsoft SDKs\\NuGetPackages\\": {},
|
||||
"https://api.nuget.org/v3/index.json": {},
|
||||
"https://nuget.cdn.azure.cn/v3/index.json": {},
|
||||
"https://packages.chinacloudapi.cn/v3/index.json": {},
|
||||
"https://packages.microsoft.com/dotnet": {},
|
||||
"https://www.nuget.org/api/v2/": {}
|
||||
},
|
||||
"frameworks": {
|
||||
"net9.0": {
|
||||
"targetAlias": "net9.0",
|
||||
"projectReferences": {}
|
||||
}
|
||||
},
|
||||
"warningProperties": {
|
||||
"warnAsError": [
|
||||
"NU1605"
|
||||
]
|
||||
},
|
||||
"restoreAuditProperties": {
|
||||
"enableAudit": "true",
|
||||
"auditLevel": "low",
|
||||
"auditMode": "direct"
|
||||
},
|
||||
"SdkAnalysisLevel": "9.0.300"
|
||||
},
|
||||
"frameworks": {
|
||||
"net9.0": {
|
||||
"targetAlias": "net9.0",
|
||||
"dependencies": {
|
||||
"Microsoft.AspNetCore.OpenApi": {
|
||||
"target": "Package",
|
||||
"version": "[9.0.8, )"
|
||||
}
|
||||
},
|
||||
"imports": [
|
||||
"net461",
|
||||
"net462",
|
||||
"net47",
|
||||
"net471",
|
||||
"net472",
|
||||
"net48",
|
||||
"net481"
|
||||
],
|
||||
"assetTargetFallback": true,
|
||||
"warn": true,
|
||||
"frameworkReferences": {
|
||||
"Microsoft.AspNetCore.App": {
|
||||
"privateAssets": "none"
|
||||
},
|
||||
"Microsoft.NETCore.App": {
|
||||
"privateAssets": "all"
|
||||
}
|
||||
},
|
||||
"runtimeIdentifierGraphPath": "C:\\Program Files\\dotnet\\sdk\\9.0.304/PortableRuntimeIdentifierGraph.json"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
16
SimpleAPI/obj/SimpleAPI.csproj.nuget.g.props
Normal file
16
SimpleAPI/obj/SimpleAPI.csproj.nuget.g.props
Normal file
@@ -0,0 +1,16 @@
|
||||
<?xml version="1.0" encoding="utf-8" standalone="no"?>
|
||||
<Project ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup Condition=" '$(ExcludeRestorePackageImports)' != 'true' ">
|
||||
<RestoreSuccess Condition=" '$(RestoreSuccess)' == '' ">True</RestoreSuccess>
|
||||
<RestoreTool Condition=" '$(RestoreTool)' == '' ">NuGet</RestoreTool>
|
||||
<ProjectAssetsFile Condition=" '$(ProjectAssetsFile)' == '' ">$(MSBuildThisFileDirectory)project.assets.json</ProjectAssetsFile>
|
||||
<NuGetPackageRoot Condition=" '$(NuGetPackageRoot)' == '' ">$(UserProfile)\.nuget\packages\</NuGetPackageRoot>
|
||||
<NuGetPackageFolders Condition=" '$(NuGetPackageFolders)' == '' ">C:\Users\代\.nuget\packages\;C:\Program Files (x86)\Microsoft Visual Studio\Shared\NuGetPackages</NuGetPackageFolders>
|
||||
<NuGetProjectStyle Condition=" '$(NuGetProjectStyle)' == '' ">PackageReference</NuGetProjectStyle>
|
||||
<NuGetToolVersion Condition=" '$(NuGetToolVersion)' == '' ">6.14.0</NuGetToolVersion>
|
||||
</PropertyGroup>
|
||||
<ItemGroup Condition=" '$(ExcludeRestorePackageImports)' != 'true' ">
|
||||
<SourceRoot Include="C:\Users\代\.nuget\packages\" />
|
||||
<SourceRoot Include="C:\Program Files (x86)\Microsoft Visual Studio\Shared\NuGetPackages\" />
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
2
SimpleAPI/obj/SimpleAPI.csproj.nuget.g.targets
Normal file
2
SimpleAPI/obj/SimpleAPI.csproj.nuget.g.targets
Normal file
@@ -0,0 +1,2 @@
|
||||
<?xml version="1.0" encoding="utf-8" standalone="no"?>
|
||||
<Project ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" />
|
||||
108
SimpleAPI/obj/project.assets.json
Normal file
108
SimpleAPI/obj/project.assets.json
Normal file
@@ -0,0 +1,108 @@
|
||||
{
|
||||
"version": 3,
|
||||
"targets": {
|
||||
"net9.0": {}
|
||||
},
|
||||
"libraries": {},
|
||||
"projectFileDependencyGroups": {
|
||||
"net9.0": [
|
||||
"Microsoft.AspNetCore.OpenApi >= 9.0.8"
|
||||
]
|
||||
},
|
||||
"packageFolders": {
|
||||
"C:\\Users\\代\\.nuget\\packages\\": {},
|
||||
"C:\\Program Files (x86)\\Microsoft Visual Studio\\Shared\\NuGetPackages": {}
|
||||
},
|
||||
"project": {
|
||||
"version": "1.0.0",
|
||||
"restore": {
|
||||
"projectUniqueName": "C:\\work\\电脑硬件-01\\SimpleAPI\\SimpleAPI.csproj",
|
||||
"projectName": "SimpleAPI",
|
||||
"projectPath": "C:\\work\\电脑硬件-01\\SimpleAPI\\SimpleAPI.csproj",
|
||||
"packagesPath": "C:\\Users\\代\\.nuget\\packages\\",
|
||||
"outputPath": "C:\\work\\电脑硬件-01\\SimpleAPI\\obj\\",
|
||||
"projectStyle": "PackageReference",
|
||||
"fallbackFolders": [
|
||||
"C:\\Program Files (x86)\\Microsoft Visual Studio\\Shared\\NuGetPackages"
|
||||
],
|
||||
"configFilePaths": [
|
||||
"C:\\Users\\代\\AppData\\Roaming\\NuGet\\NuGet.Config",
|
||||
"C:\\Program Files (x86)\\NuGet\\Config\\Microsoft.VisualStudio.FallbackLocation.config",
|
||||
"C:\\Program Files (x86)\\NuGet\\Config\\Microsoft.VisualStudio.Offline.config"
|
||||
],
|
||||
"originalTargetFrameworks": [
|
||||
"net9.0"
|
||||
],
|
||||
"sources": {
|
||||
"C:\\Program Files (x86)\\Microsoft SDKs\\NuGetPackages\\": {},
|
||||
"https://api.nuget.org/v3/index.json": {},
|
||||
"https://nuget.cdn.azure.cn/v3/index.json": {},
|
||||
"https://packages.chinacloudapi.cn/v3/index.json": {},
|
||||
"https://packages.microsoft.com/dotnet": {},
|
||||
"https://www.nuget.org/api/v2/": {}
|
||||
},
|
||||
"frameworks": {
|
||||
"net9.0": {
|
||||
"targetAlias": "net9.0",
|
||||
"projectReferences": {}
|
||||
}
|
||||
},
|
||||
"warningProperties": {
|
||||
"warnAsError": [
|
||||
"NU1605"
|
||||
]
|
||||
},
|
||||
"restoreAuditProperties": {
|
||||
"enableAudit": "true",
|
||||
"auditLevel": "low",
|
||||
"auditMode": "direct"
|
||||
},
|
||||
"SdkAnalysisLevel": "9.0.300"
|
||||
},
|
||||
"frameworks": {
|
||||
"net9.0": {
|
||||
"targetAlias": "net9.0",
|
||||
"dependencies": {
|
||||
"Microsoft.AspNetCore.OpenApi": {
|
||||
"target": "Package",
|
||||
"version": "[9.0.8, )"
|
||||
}
|
||||
},
|
||||
"imports": [
|
||||
"net461",
|
||||
"net462",
|
||||
"net47",
|
||||
"net471",
|
||||
"net472",
|
||||
"net48",
|
||||
"net481"
|
||||
],
|
||||
"assetTargetFallback": true,
|
||||
"warn": true,
|
||||
"frameworkReferences": {
|
||||
"Microsoft.AspNetCore.App": {
|
||||
"privateAssets": "none"
|
||||
},
|
||||
"Microsoft.NETCore.App": {
|
||||
"privateAssets": "all"
|
||||
}
|
||||
},
|
||||
"runtimeIdentifierGraphPath": "C:\\Program Files\\dotnet\\sdk\\9.0.304/PortableRuntimeIdentifierGraph.json"
|
||||
}
|
||||
}
|
||||
},
|
||||
"logs": [
|
||||
{
|
||||
"code": "NU1301",
|
||||
"level": "Error",
|
||||
"message": "未能从远程源“https://www.nuget.org/api/v2/FindPackagesById()?id='Microsoft.AspNetCore.OpenApi'&semVerLevel=2.0.0”检索有关“Microsoft.AspNetCore.OpenApi”的信息。\r\n 不知道这样的主机。 (null:80)\r\n 不知道这样的主机。",
|
||||
"libraryId": "Microsoft.AspNetCore.OpenApi"
|
||||
},
|
||||
{
|
||||
"code": "NU1301",
|
||||
"level": "Error",
|
||||
"message": "未能从远程源“https://packages.microsoft.com/dotnet/FindPackagesById()?id='Microsoft.AspNetCore.OpenApi'&semVerLevel=2.0.0”检索有关“Microsoft.AspNetCore.OpenApi”的信息。\r\n 不知道这样的主机。 (null:80)\r\n 不知道这样的主机。",
|
||||
"libraryId": "Microsoft.AspNetCore.OpenApi"
|
||||
}
|
||||
]
|
||||
}
|
||||
27
SimpleAPI/obj/project.nuget.cache
Normal file
27
SimpleAPI/obj/project.nuget.cache
Normal file
@@ -0,0 +1,27 @@
|
||||
{
|
||||
"version": 2,
|
||||
"dgSpecHash": "qHQETFOfcmo=",
|
||||
"success": false,
|
||||
"projectFilePath": "C:\\work\\电脑硬件-01\\SimpleAPI\\SimpleAPI.csproj",
|
||||
"expectedPackageFiles": [],
|
||||
"logs": [
|
||||
{
|
||||
"code": "NU1301",
|
||||
"level": "Error",
|
||||
"message": "未能从远程源“https://www.nuget.org/api/v2/FindPackagesById()?id='Microsoft.AspNetCore.OpenApi'&semVerLevel=2.0.0”检索有关“Microsoft.AspNetCore.OpenApi”的信息。\r\n 不知道这样的主机。 (null:80)\r\n 不知道这样的主机。",
|
||||
"projectPath": "C:\\work\\电脑硬件-01\\SimpleAPI\\SimpleAPI.csproj",
|
||||
"filePath": "C:\\work\\电脑硬件-01\\SimpleAPI\\SimpleAPI.csproj",
|
||||
"libraryId": "Microsoft.AspNetCore.OpenApi",
|
||||
"targetGraphs": []
|
||||
},
|
||||
{
|
||||
"code": "NU1301",
|
||||
"level": "Error",
|
||||
"message": "未能从远程源“https://packages.microsoft.com/dotnet/FindPackagesById()?id='Microsoft.AspNetCore.OpenApi'&semVerLevel=2.0.0”检索有关“Microsoft.AspNetCore.OpenApi”的信息。\r\n 不知道这样的主机。 (null:80)\r\n 不知道这样的主机。",
|
||||
"projectPath": "C:\\work\\电脑硬件-01\\SimpleAPI\\SimpleAPI.csproj",
|
||||
"filePath": "C:\\work\\电脑硬件-01\\SimpleAPI\\SimpleAPI.csproj",
|
||||
"libraryId": "Microsoft.AspNetCore.OpenApi",
|
||||
"targetGraphs": []
|
||||
}
|
||||
]
|
||||
}
|
||||
Reference in New Issue
Block a user