app.Run(async (context) =>
{
context.Response.ContentType = "text/html";
await context.Response.SendFileAsync(Path.Combine(env.WebRootPath, "index.html"));
});
本文介绍在ASP.NET Core应用中如何处理静态文件,包括设置响应类型为text/html并从特定路径发送index.html文件的过程。这适用于前端资源的托管,确保应用程序能够正确地返回所需的静态内容。
app.Run(async (context) =>
{
context.Response.ContentType = "text/html";
await context.Response.SendFileAsync(Path.Combine(env.WebRootPath, "index.html"));
});
520
425
466

被折叠的 条评论
为什么被折叠?