我试图同时使用控制器视图和剃刀页面。但是添加 builder.Services.AddRazorPages().AddRazorRuntimeCompilation(); 后 当我运行网络项目时,我的代码中的这一行显示 无法找到此本地主机页面 已找到以下网址的网页:https://localhost:7135/ HTTP 错误 404
我尝试重新安装 nu get 软件包。但不工作。我是 .net core 6 的新手
app.MapPost("/Authenticate", async (HttpRequest Request) =>
{
string rawContent = string.Empty;
using (var reader = new StreamReader(Request.Body,
encoding: Encoding.UTF8, detectEncodingFromByteOrderMarks: false))
{
rawContent = await reader.ReadToEndAsync();
}
})
.WithName("Authenticate")
.WithOpenApi(openApi =>
{
openApi.RequestBody = new OpenApiRequestBody
{
Content = new Dictionary<string, OpenApiMediaType>
{
{
"application/json", new OpenApiMediaType
{
Schema = new OpenApiSchema
{
Type = "object"
}
}
}
},
Description = "JSON"
};
return openApi;
});